Concepts
The StyleSheet target uses only React Native primitives. There is nothing to configure: install a component and render it.
init selects StyleSheet when your project has no NativeWind or Tailwind config. To switch later, set the target in nativra.json — future add and update runs install the StyleSheet versions.
{
"stylingTarget": "stylesheet"
}npx nativra-cli add badgeStatic layout goes in StyleSheet.create. Colors come from your installed theme through useThemeColors(), which also follows the device's light or dark setting:
import { View, Text, StyleSheet, type ViewStyle } from "react-native";
import { type ThemeColors, alpha, useThemeColors } from "@/hooks/use-theme-colors";
const styles = StyleSheet.create({
base: { flexDirection: "row", alignItems: "center", borderRadius: 999 },
md: { paddingHorizontal: 10, paddingVertical: 2 },
});
function getContainerStyle(variant: BadgeVariant, c: ThemeColors): ViewStyle {
const map: Record<BadgeVariant, ViewStyle> = {
default: { backgroundColor: c.foreground },
primary: { backgroundColor: alpha(c.primary, 0.12) },
// …
};
return map[variant];
}
export function Badge({ label, variant = "default", size = "md" }: BadgeProps) {
const c = useThemeColors();
return (
<View style={[styles.base, styles[size], getContainerStyle(variant, c)]}>
<Text>{label}</Text>
</View>
);
}dark: variants, matching a web codebase. Needs one-time setup.Both targets have the same props, so switching later doesn't change how your screens use the components.