Styling
How styles are applied in CraftReactNative using Unistyles.
All components use Unistyles v3 for styling. Styles automatically update when themes change without causing re-renders.
Basic usage
Use StyleSheet.create with theme functions:
Dynamic styles
Create style functions for props-based styling:
Avoid useUnistyles
Don't use useUnistyles - it causes re-renders on every theme change. Only use it for:
- Third-party components that don't accept style props
- React Navigation configuration
Project-specific notes
- All components in
@craftrn-uiuse this pattern - Theme tokens are available:
theme.colors,theme.spacing,theme.borderRadius,theme.textVariants - Styles update automatically when switching themes via
UnistylesRuntime.setTheme() - TypeScript provides full autocomplete for theme properties