Provide a stable, token-driven UI contract so screens are consistent across brands, modes, and accessibility font scales.
spacing(xs..xl) insrc/theme/tokens/base.tsradius(sm..lg) insrc/theme/tokens/base.ts
ThemeColors contract in src/theme/types.ts:
- surfaces (
background,surface,surfaceAlt) - text (
text,textMuted,textInverse) - borders (
border,borderStrong) - actions (
primary,primaryMuted,accent) - feedback (
error,success) - inputs/overlays (
inputBackground,inputPlaceholder,screenOverlay)
- Base style roles in
src/theme/typography/base.ts - Runtime scaled typography build in
src/theme/typography/build.ts - Font family mapping in
src/theme/font/families.ts
Every consumer gets one Theme object:
id,mode,brand,isDarkfontScale,fontScalePreferencecolors,spacing,typography,radius
Do not bypass this object with ad-hoc constants in screens.
- Use
createStyles(theme)and derive style values from tokens. - Avoid raw numeric spacing/colors unless part of a reusable token update.
- Keep font sizes and weights sourced from
theme.typography.*. - Use semantic colors (
error,success) instead of hardcoded hex values.
- Files: kebab-case (e.g.
welcome-screen.tsx,use-auth-store.ts). - React components: PascalCase exports (
WelcomeScreen). - Hooks:
useXxx. - Types/interfaces: PascalCase (
Theme,RootStackParamList). - Constants: UPPER_SNAKE_CASE for static lists and keys (
QUERY_KEYS,OTP_PORTAL). - Route names: enum members in PascalCase with kebab-case string values.
- Add/update tokens first.
- Regenerate or adjust theme creation if token shape changes.
- Update affected component style factories.
- Verify light/dark + brand variants.
- Verify text scaling behavior (
small/medium/large/system). - Add tests for pure token/typography logic when behavior changes.