react-native-terra-ui 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/lib/module/components/avatar/Avatar.js +118 -35
  3. package/lib/module/components/avatar/Avatar.js.map +1 -1
  4. package/lib/module/components/box/Box.js +15 -2
  5. package/lib/module/components/box/Box.js.map +1 -1
  6. package/lib/module/components/box/utils.js +4 -1
  7. package/lib/module/components/box/utils.js.map +1 -1
  8. package/lib/module/components/button/Button.js +7 -14
  9. package/lib/module/components/button/Button.js.map +1 -1
  10. package/lib/module/components/chip/Chip.js +372 -0
  11. package/lib/module/components/chip/Chip.js.map +1 -0
  12. package/lib/module/components/chip/index.js +4 -0
  13. package/lib/module/components/chip/index.js.map +1 -0
  14. package/lib/module/components/chip/types.js +2 -0
  15. package/lib/module/components/chip/types.js.map +1 -0
  16. package/lib/module/components/chip/utils.js +36 -0
  17. package/lib/module/components/chip/utils.js.map +1 -0
  18. package/lib/module/components/empty-state/EmptyState.js +200 -0
  19. package/lib/module/components/empty-state/EmptyState.js.map +1 -0
  20. package/lib/module/components/empty-state/index.js +4 -0
  21. package/lib/module/components/empty-state/index.js.map +1 -0
  22. package/lib/module/components/empty-state/types.js +2 -0
  23. package/lib/module/components/empty-state/types.js.map +1 -0
  24. package/lib/module/components/header/header-buttons.js +31 -36
  25. package/lib/module/components/header/header-buttons.js.map +1 -1
  26. package/lib/module/components/header/index.js +1 -1
  27. package/lib/module/components/header/index.js.map +1 -1
  28. package/lib/module/components/header/parts/HeaderGradientOverlay.js +38 -0
  29. package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -0
  30. package/lib/module/components/header/variants/LargeTitleHeader/index.js +69 -99
  31. package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
  32. package/lib/module/components/header/variants/TitleHeader/index.js +32 -63
  33. package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
  34. package/lib/module/components/icon/Icon.js +20 -8
  35. package/lib/module/components/icon/Icon.js.map +1 -1
  36. package/lib/module/components/image/Image.js +54 -0
  37. package/lib/module/components/image/Image.js.map +1 -0
  38. package/lib/module/components/image/index.js +4 -0
  39. package/lib/module/components/image/index.js.map +1 -0
  40. package/lib/module/components/image/types.js +4 -0
  41. package/lib/module/components/image/types.js.map +1 -0
  42. package/lib/module/components/index.js +4 -0
  43. package/lib/module/components/index.js.map +1 -1
  44. package/lib/module/components/portal/Portal.js +42 -0
  45. package/lib/module/components/portal/Portal.js.map +1 -0
  46. package/lib/module/components/portal/PortalContext.js +1 -16
  47. package/lib/module/components/portal/PortalContext.js.map +1 -1
  48. package/lib/module/components/portal/PortalHost.js +16 -14
  49. package/lib/module/components/portal/PortalHost.js.map +1 -1
  50. package/lib/module/components/portal/PortalProvider.js +51 -19
  51. package/lib/module/components/portal/PortalProvider.js.map +1 -1
  52. package/lib/module/components/portal/index.js +1 -1
  53. package/lib/module/components/portal/index.js.map +1 -1
  54. package/lib/module/components/screen/Screen.js +25 -28
  55. package/lib/module/components/screen/Screen.js.map +1 -1
  56. package/lib/module/components/screen/ScreenContext.js +7 -5
  57. package/lib/module/components/screen/ScreenContext.js.map +1 -1
  58. package/lib/module/components/screen/ScreenFlashList.js +144 -0
  59. package/lib/module/components/screen/ScreenFlashList.js.map +1 -0
  60. package/lib/module/components/screen/ScreenFlatList.js +88 -27
  61. package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
  62. package/lib/module/components/screen/ScreenScrollView.js +101 -34
  63. package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
  64. package/lib/module/components/screen/index.js +1 -0
  65. package/lib/module/components/screen/index.js.map +1 -1
  66. package/lib/module/components/screen/parts/BottomSafeArea.js +62 -0
  67. package/lib/module/components/screen/parts/BottomSafeArea.js.map +1 -0
  68. package/lib/module/components/screen/parts/ScreenPlaceholder.js +50 -0
  69. package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -0
  70. package/lib/module/components/screen/types.js +4 -0
  71. package/lib/module/components/screen/types.js.map +1 -0
  72. package/lib/module/components/screen/utils.js +12 -9
  73. package/lib/module/components/screen/utils.js.map +1 -1
  74. package/lib/module/components/surface/Surface.js +16 -9
  75. package/lib/module/components/surface/Surface.js.map +1 -1
  76. package/lib/module/components/text/Text.js +23 -5
  77. package/lib/module/components/text/Text.js.map +1 -1
  78. package/lib/module/components/toast/Toast.js +8 -8
  79. package/lib/module/components/toast/Toast.js.map +1 -1
  80. package/lib/module/components/toolbar/Toolbar.js +268 -0
  81. package/lib/module/components/toolbar/Toolbar.js.map +1 -0
  82. package/lib/module/components/toolbar/index.js +4 -0
  83. package/lib/module/components/toolbar/index.js.map +1 -0
  84. package/lib/module/context/ThemeProvider.js +5 -2
  85. package/lib/module/context/ThemeProvider.js.map +1 -1
  86. package/lib/module/{components/icon/utils.js → theme/defaults/icons.js} +1 -1
  87. package/lib/module/theme/defaults/icons.js.map +1 -0
  88. package/lib/module/theme/defaults/image.js +30 -0
  89. package/lib/module/theme/defaults/image.js.map +1 -0
  90. package/lib/module/theme/index.js +1 -1
  91. package/lib/module/theme/{configure.js → registry.js} +21 -28
  92. package/lib/module/theme/registry.js.map +1 -0
  93. package/lib/module/theme/runtime.js +1 -1
  94. package/lib/module/theme/theme.js +91 -10
  95. package/lib/module/theme/theme.js.map +1 -1
  96. package/lib/module/theme/tokens/dark.js +59 -68
  97. package/lib/module/theme/tokens/dark.js.map +1 -1
  98. package/lib/module/theme/tokens/light.js +49 -67
  99. package/lib/module/theme/tokens/light.js.map +1 -1
  100. package/lib/module/theme/tokens/primitives.js +241 -20
  101. package/lib/module/theme/tokens/primitives.js.map +1 -1
  102. package/lib/module/utils/accent-utils.js +4 -4
  103. package/lib/module/utils/accent-utils.js.map +1 -1
  104. package/lib/typescript/src/components/avatar/Avatar.d.ts.map +1 -1
  105. package/lib/typescript/src/components/avatar/types.d.ts +4 -4
  106. package/lib/typescript/src/components/avatar/types.d.ts.map +1 -1
  107. package/lib/typescript/src/components/box/Box.d.ts.map +1 -1
  108. package/lib/typescript/src/components/box/utils.d.ts +6 -1
  109. package/lib/typescript/src/components/box/utils.d.ts.map +1 -1
  110. package/lib/typescript/src/components/button/Button.d.ts +1 -1
  111. package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
  112. package/lib/typescript/src/components/chip/Chip.d.ts +24 -0
  113. package/lib/typescript/src/components/chip/Chip.d.ts.map +1 -0
  114. package/lib/typescript/src/components/chip/index.d.ts +4 -0
  115. package/lib/typescript/src/components/chip/index.d.ts.map +1 -0
  116. package/lib/typescript/src/components/chip/types.d.ts +8 -0
  117. package/lib/typescript/src/components/chip/types.d.ts.map +1 -0
  118. package/lib/typescript/src/components/chip/utils.d.ts +8 -0
  119. package/lib/typescript/src/components/chip/utils.d.ts.map +1 -0
  120. package/lib/typescript/src/components/empty-state/EmptyState.d.ts +45 -0
  121. package/lib/typescript/src/components/empty-state/EmptyState.d.ts.map +1 -0
  122. package/lib/typescript/src/components/empty-state/index.d.ts +4 -0
  123. package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -0
  124. package/lib/typescript/src/components/empty-state/types.d.ts +6 -0
  125. package/lib/typescript/src/components/empty-state/types.d.ts.map +1 -0
  126. package/lib/typescript/src/components/header/header-buttons.d.ts +27 -0
  127. package/lib/typescript/src/components/header/header-buttons.d.ts.map +1 -1
  128. package/lib/typescript/src/components/header/index.d.ts +1 -1
  129. package/lib/typescript/src/components/header/index.d.ts.map +1 -1
  130. package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts +7 -0
  131. package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts.map +1 -0
  132. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +1 -1
  133. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
  134. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +18 -7
  135. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
  136. package/lib/typescript/src/components/icon/Icon.d.ts.map +1 -1
  137. package/lib/typescript/src/components/image/Image.d.ts +16 -0
  138. package/lib/typescript/src/components/image/Image.d.ts.map +1 -0
  139. package/lib/typescript/src/components/image/index.d.ts +3 -0
  140. package/lib/typescript/src/components/image/index.d.ts.map +1 -0
  141. package/lib/typescript/src/components/image/types.d.ts +7 -0
  142. package/lib/typescript/src/components/image/types.d.ts.map +1 -0
  143. package/lib/typescript/src/components/index.d.ts +4 -0
  144. package/lib/typescript/src/components/index.d.ts.map +1 -1
  145. package/lib/typescript/src/components/portal/Portal.d.ts +26 -0
  146. package/lib/typescript/src/components/portal/Portal.d.ts.map +1 -0
  147. package/lib/typescript/src/components/portal/PortalContext.d.ts +11 -14
  148. package/lib/typescript/src/components/portal/PortalContext.d.ts.map +1 -1
  149. package/lib/typescript/src/components/portal/PortalHost.d.ts +9 -4
  150. package/lib/typescript/src/components/portal/PortalHost.d.ts.map +1 -1
  151. package/lib/typescript/src/components/portal/PortalProvider.d.ts +3 -3
  152. package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -1
  153. package/lib/typescript/src/components/portal/index.d.ts +4 -2
  154. package/lib/typescript/src/components/portal/index.d.ts.map +1 -1
  155. package/lib/typescript/src/components/screen/Screen.d.ts +18 -13
  156. package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
  157. package/lib/typescript/src/components/screen/ScreenContext.d.ts +12 -9
  158. package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
  159. package/lib/typescript/src/components/screen/ScreenFlashList.d.ts +43 -0
  160. package/lib/typescript/src/components/screen/ScreenFlashList.d.ts.map +1 -0
  161. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +17 -7
  162. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
  163. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +51 -16
  164. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
  165. package/lib/typescript/src/components/screen/index.d.ts +3 -0
  166. package/lib/typescript/src/components/screen/index.d.ts.map +1 -1
  167. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts +30 -0
  168. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +1 -0
  169. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +22 -0
  170. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -0
  171. package/lib/typescript/src/components/screen/types.d.ts +42 -0
  172. package/lib/typescript/src/components/screen/types.d.ts.map +1 -0
  173. package/lib/typescript/src/components/screen/utils.d.ts +9 -9
  174. package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
  175. package/lib/typescript/src/components/surface/Surface.d.ts +7 -0
  176. package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -1
  177. package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
  178. package/lib/typescript/src/components/toolbar/Toolbar.d.ts +115 -0
  179. package/lib/typescript/src/components/toolbar/Toolbar.d.ts.map +1 -0
  180. package/lib/typescript/src/components/toolbar/index.d.ts +3 -0
  181. package/lib/typescript/src/components/toolbar/index.d.ts.map +1 -0
  182. package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
  183. package/lib/typescript/src/{components/icon/utils.d.ts → theme/defaults/icons.d.ts} +2 -2
  184. package/lib/typescript/src/theme/defaults/icons.d.ts.map +1 -0
  185. package/lib/typescript/src/theme/defaults/image.d.ts +4 -0
  186. package/lib/typescript/src/theme/defaults/image.d.ts.map +1 -0
  187. package/lib/typescript/src/theme/index.d.ts +1 -1
  188. package/lib/typescript/src/theme/index.d.ts.map +1 -1
  189. package/lib/typescript/src/theme/{configure.d.ts → registry.d.ts} +1 -1
  190. package/lib/typescript/src/theme/registry.d.ts.map +1 -0
  191. package/lib/typescript/src/theme/theme.d.ts +21 -1
  192. package/lib/typescript/src/theme/theme.d.ts.map +1 -1
  193. package/lib/typescript/src/theme/tokens/dark.d.ts +41 -64
  194. package/lib/typescript/src/theme/tokens/dark.d.ts.map +1 -1
  195. package/lib/typescript/src/theme/tokens/light.d.ts +44 -65
  196. package/lib/typescript/src/theme/tokens/light.d.ts.map +1 -1
  197. package/lib/typescript/src/theme/tokens/primitives.d.ts +228 -17
  198. package/lib/typescript/src/theme/tokens/primitives.d.ts.map +1 -1
  199. package/lib/typescript/src/theme/types.d.ts +65 -35
  200. package/lib/typescript/src/theme/types.d.ts.map +1 -1
  201. package/package.json +23 -9
  202. package/skills/terra-ui/SKILL.md +193 -0
  203. package/skills/terra-ui/references/recipes.md +198 -0
  204. package/skills/terra-ui/references/troubleshooting.md +112 -0
  205. package/src/components/avatar/Avatar.tsx +128 -38
  206. package/src/components/avatar/types.ts +5 -5
  207. package/src/components/box/Box.tsx +13 -1
  208. package/src/components/box/utils.ts +10 -0
  209. package/src/components/button/Button.tsx +7 -15
  210. package/src/components/chip/Chip.tsx +444 -0
  211. package/src/components/chip/index.ts +3 -0
  212. package/src/components/chip/types.ts +15 -0
  213. package/src/components/chip/utils.ts +34 -0
  214. package/src/components/empty-state/EmptyState.tsx +209 -0
  215. package/src/components/empty-state/index.ts +3 -0
  216. package/src/components/empty-state/types.ts +5 -0
  217. package/src/components/header/header-buttons.tsx +33 -45
  218. package/src/components/header/index.ts +2 -0
  219. package/src/components/header/parts/HeaderGradientOverlay.tsx +29 -0
  220. package/src/components/header/variants/LargeTitleHeader/index.tsx +68 -102
  221. package/src/components/header/variants/TitleHeader/index.tsx +47 -56
  222. package/src/components/icon/Icon.tsx +20 -15
  223. package/src/components/image/Image.tsx +48 -0
  224. package/src/components/image/index.ts +2 -0
  225. package/src/components/image/types.ts +7 -0
  226. package/src/components/index.ts +4 -0
  227. package/src/components/portal/Portal.tsx +55 -0
  228. package/src/components/portal/PortalContext.tsx +14 -22
  229. package/src/components/portal/PortalHost.tsx +17 -10
  230. package/src/components/portal/PortalProvider.tsx +58 -21
  231. package/src/components/portal/index.ts +4 -2
  232. package/src/components/screen/Screen.tsx +45 -59
  233. package/src/components/screen/ScreenContext.tsx +19 -12
  234. package/src/components/screen/ScreenFlashList.tsx +196 -0
  235. package/src/components/screen/ScreenFlatList.tsx +100 -39
  236. package/src/components/screen/ScreenScrollView.tsx +114 -53
  237. package/src/components/screen/index.ts +3 -0
  238. package/src/components/screen/parts/BottomSafeArea.tsx +60 -0
  239. package/src/components/screen/parts/ScreenPlaceholder.tsx +55 -0
  240. package/src/components/screen/types.ts +43 -0
  241. package/src/components/screen/utils.ts +29 -15
  242. package/src/components/surface/Surface.tsx +17 -20
  243. package/src/components/text/Text.tsx +23 -5
  244. package/src/components/toast/Toast.tsx +8 -8
  245. package/src/components/toolbar/Toolbar.tsx +353 -0
  246. package/src/components/toolbar/index.ts +6 -0
  247. package/src/context/ThemeProvider.tsx +5 -4
  248. package/src/{components/icon/utils.tsx → theme/defaults/icons.tsx} +1 -1
  249. package/src/theme/defaults/image.tsx +34 -0
  250. package/src/theme/index.ts +1 -1
  251. package/src/theme/{configure.ts → registry.ts} +19 -34
  252. package/src/theme/runtime.ts +1 -1
  253. package/src/theme/theme.ts +127 -13
  254. package/src/theme/tokens/dark.ts +60 -69
  255. package/src/theme/tokens/light.ts +50 -68
  256. package/src/theme/tokens/primitives.ts +248 -20
  257. package/src/theme/types.ts +67 -35
  258. package/src/utils/accent-utils.ts +4 -4
  259. package/lib/module/components/icon/utils.js.map +0 -1
  260. package/lib/module/theme/configure.js.map +0 -1
  261. package/lib/typescript/src/components/icon/utils.d.ts.map +0 -1
  262. package/lib/typescript/src/theme/configure.d.ts.map +0 -1
@@ -52,6 +52,16 @@ export interface Typography {
52
52
  * (e.g. { regular: 'Inter-Regular', semibold: 'Inter-SemiBold' }).
53
53
  */
54
54
  fonts: Record<FontWeightToken, string>;
55
+ /**
56
+ * Weight token → italic font-family name. Optional per weight.
57
+ * Custom fonts can't be slanted via `fontStyle: 'italic'` (that's a no-op
58
+ * for a non-system `fontFamily` on iOS/Android) — point each weight at its
59
+ * dedicated italic file (e.g. { bold: 'Inter-BoldItalic' }) to make
60
+ * `<Text italic />` render correctly. Weights left unset fall back to the
61
+ * upright family in `fonts`. Not needed for the system font, which can
62
+ * synthesize italic on its own.
63
+ */
64
+ fontsItalic?: Partial<Record<FontWeightToken, string>>;
55
65
  variants: Record<RoleTextVariant, TypeStyle>;
56
66
  }
57
67
  /**
@@ -60,6 +70,7 @@ export interface Typography {
60
70
  */
61
71
  export interface ThemeColor {
62
72
  background: string;
73
+ shadow: string;
63
74
  'surface.default': string;
64
75
  'surface.raised': string;
65
76
  'surface.sunken': string;
@@ -85,40 +96,46 @@ export interface ThemeColor {
85
96
  'action.bg.primary.active': string;
86
97
  'action.bg.primary.disabled': string;
87
98
  'action.fg.primary': string;
88
- 'action.bg.subtle': string;
89
- 'action.bg.subtle.hover': string;
90
- 'action.bg.subtle.active': string;
91
- 'action.bg.subtle.disabled': string;
92
- 'action.fg.subtle': string;
93
- 'action.bg.neutral': string;
94
- 'action.bg.neutral.hover': string;
95
- 'action.bg.neutral.active': string;
96
- 'action.bg.neutral.disabled': string;
97
- 'action.fg.neutral': string;
98
- 'status.bg.success': string;
99
- 'status.bg.success.subtle': string;
100
- 'status.border.success': string;
101
- 'status.border.success.subtle': string;
102
- 'status.fg.success': string;
103
- 'status.fg.success.subtle': string;
104
- 'status.bg.warning': string;
105
- 'status.bg.warning.subtle': string;
106
- 'status.border.warning': string;
107
- 'status.border.warning.subtle': string;
108
- 'status.fg.warning': string;
109
- 'status.fg.warning.subtle': string;
110
- 'status.bg.danger': string;
111
- 'status.bg.danger.subtle': string;
112
- 'status.border.danger': string;
113
- 'status.border.danger.subtle': string;
114
- 'status.fg.danger': string;
115
- 'status.fg.danger.subtle': string;
116
- 'status.bg.info': string;
117
- 'status.bg.info.subtle': string;
118
- 'status.border.info': string;
119
- 'status.border.info.subtle': string;
120
- 'status.fg.info': string;
121
- 'status.fg.info.subtle': string;
99
+ 'action.bg.primary.subtle': string;
100
+ 'action.bg.primary.subtle.hover': string;
101
+ 'action.bg.primary.subtle.active': string;
102
+ 'action.bg.primary.subtle.disabled': string;
103
+ 'action.fg.primary.subtle': string;
104
+ 'action.bg.secondary': string;
105
+ 'action.fg.secondary': string;
106
+ 'action.bg.secondary.subtle': string;
107
+ 'action.bg.secondary.subtle.hover': string;
108
+ 'action.bg.secondary.subtle.active': string;
109
+ 'action.bg.secondary.subtle.disabled': string;
110
+ 'action.fg.secondary.subtle': string;
111
+ 'status.success': string;
112
+ 'status.success.bg': string;
113
+ 'status.success.bg.subtle': string;
114
+ 'status.success.border': string;
115
+ 'status.success.border.subtle': string;
116
+ 'status.success.fg': string;
117
+ 'status.success.fg.subtle': string;
118
+ 'status.warning': string;
119
+ 'status.warning.bg': string;
120
+ 'status.warning.bg.subtle': string;
121
+ 'status.warning.border': string;
122
+ 'status.warning.border.subtle': string;
123
+ 'status.warning.fg': string;
124
+ 'status.warning.fg.subtle': string;
125
+ 'status.danger': string;
126
+ 'status.danger.bg': string;
127
+ 'status.danger.bg.subtle': string;
128
+ 'status.danger.border': string;
129
+ 'status.danger.border.subtle': string;
130
+ 'status.danger.fg': string;
131
+ 'status.danger.fg.subtle': string;
132
+ 'status.info': string;
133
+ 'status.info.bg': string;
134
+ 'status.info.bg.subtle': string;
135
+ 'status.info.border': string;
136
+ 'status.info.border.subtle': string;
137
+ 'status.info.fg': string;
138
+ 'status.info.fg.subtle': string;
122
139
  }
123
140
  /** State-layer opacities for disabled / pressed feedback. */
124
141
  export interface OpacityTokens {
@@ -195,6 +212,10 @@ export interface TerraImageProps {
195
212
  style?: StyleProp<ImageStyle>;
196
213
  accessibilityLabel?: string;
197
214
  contentFit?: TerraImageContentFit;
215
+ /** Shown while `source` is loading (and if it fails to resolve). */
216
+ placeholder?: {
217
+ uri: string;
218
+ } | number;
198
219
  onError?: () => void;
199
220
  }
200
221
  export type TerraImageComponent = ComponentType<TerraImageProps>;
@@ -218,9 +239,18 @@ export type ThemeRadiusOverride = DeepPartial<TerraTheme['radius']> & {
218
239
  */
219
240
  base?: number;
220
241
  };
242
+ export type ThemeSpacingOverride = DeepPartial<TerraTheme['spacing']> & {
243
+ /**
244
+ * Base spacing unit in dp. Every step's value is its key multiplied by this
245
+ * base (e.g. `'5'` → `5 × base`). Per-step spacing overrides still win over
246
+ * the derived value.
247
+ */
248
+ base?: number;
249
+ };
221
250
  /** Theme override accepted at configure time. */
222
- export type TerraThemeOverride = DeepPartial<Omit<TerraTheme, 'radius'>> & {
251
+ export type TerraThemeOverride = DeepPartial<Omit<TerraTheme, 'radius' | 'spacing'>> & {
223
252
  radius?: ThemeRadiusOverride;
253
+ spacing?: ThemeSpacingOverride;
224
254
  };
225
255
  /** Default props for the Button component. A per-instance prop still wins. */
226
256
  export interface ButtonDefaults {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/theme/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAClB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,CAAC;AAET,gCAAgC;AAChC,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,MAAM,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAE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,CAAC,EAAE,kBAAkB,CAAC;IAC5B,0DAA0D;IAC1D,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,kBAAkB,CAAC;QAAC,IAAI,CAAC,EAAE,kBAAkB,CAAA;KAAE,CAAC;IACpE,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC3D;;;;OAIG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,sDAAsD;IACtD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-terra-ui",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Themeable React Native UI components built on react-native-unistyles",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -23,6 +23,8 @@
23
23
  "files": [
24
24
  "src",
25
25
  "lib",
26
+ "skills",
27
+ "CHANGELOG.md",
26
28
  "!**/__tests__",
27
29
  "!**/__fixtures__",
28
30
  "!**/__mocks__",
@@ -32,6 +34,7 @@
32
34
  "build": "bob build && tsc-alias -p tsconfig.build.json --outDir lib/typescript",
33
35
  "clean": "del-cli lib",
34
36
  "prepare": "bob build && tsc-alias -p tsconfig.build.json --outDir lib/typescript",
37
+ "release": "release-it",
35
38
  "typecheck": "tsc",
36
39
  "lint": "biome check .",
37
40
  "test": "jest"
@@ -59,31 +62,39 @@
59
62
  "@jest/globals": "^29.7.0",
60
63
  "@react-native/babel-preset": "0.85.0",
61
64
  "@react-native/jest-preset": "0.85.0",
65
+ "@release-it/conventional-changelog": "^12.0.0",
66
+ "@shopify/flash-list": "^2.3.2",
62
67
  "@testing-library/react-native": "^13.3.3",
63
68
  "@types/react": "^19.2.0",
64
69
  "babel-plugin-module-resolver": "^5.0.3",
65
70
  "del-cli": "^7.0.0",
66
71
  "jest": "^29.7.0",
67
- "react": "19.2.0",
68
- "react-native": "0.83.6",
72
+ "react": "19.2.3",
73
+ "react-native": "0.85.3",
69
74
  "react-native-builder-bob": "^0.42.1",
70
75
  "react-native-edge-to-edge": "1.8.1",
71
- "react-native-nitro-modules": "0.35.9",
72
- "react-native-reanimated": "^4.4.1",
73
- "react-native-safe-area-context": "^5.8.0",
76
+ "react-native-nitro-modules": "0.36.1",
77
+ "react-native-reanimated": "4.4.3",
78
+ "react-native-safe-area-context": "5.7.0",
79
+ "react-native-screens": "4.25.2",
74
80
  "react-native-svg": "15.15.4",
75
- "react-native-unistyles": "^3.2.5",
76
- "react-test-renderer": "19.2.0",
81
+ "react-native-unistyles": "^3.3.0",
82
+ "react-native-worklets": "0.10.0",
83
+ "react-test-renderer": "19.2.3",
84
+ "release-it": "^21.0.2",
77
85
  "tsc-alias": "^1.9.1",
78
86
  "typescript": "^6.0.3"
79
87
  },
80
88
  "peerDependencies": {
89
+ "@shopify/flash-list": ">=2.0.0",
81
90
  "react": "*",
82
91
  "react-native": "*",
83
92
  "react-native-reanimated": ">=4.0.0",
84
93
  "react-native-safe-area-context": ">=4.0.0",
94
+ "react-native-screens": ">=4.16.0",
85
95
  "react-native-svg": ">=15.0.0",
86
- "react-native-unistyles": ">=3.0.0"
96
+ "react-native-unistyles": ">=3.0.0",
97
+ "react-native-worklets": ">=0.8.0"
87
98
  },
88
99
  "react-native-builder-bob": {
89
100
  "source": "src",
@@ -112,6 +123,9 @@
112
123
  "modulePathIgnorePatterns": [
113
124
  "<rootDir>/lib/"
114
125
  ],
126
+ "transformIgnorePatterns": [
127
+ "node_modules/(?!((jest-)?react-native|@react-native(-community)?|@shopify/flash-list|react-native-screens)/)"
128
+ ],
115
129
  "collectCoverageFrom": [
116
130
  "src/theme/**/*.ts",
117
131
  "src/utils/**/*.ts",
@@ -0,0 +1,193 @@
1
+ ---
2
+ name: terra-ui
3
+ description: Build React Native UI with react-native-terra-ui — setup, component selection, theming, and the traps. Use when writing screens or components in an app that depends on react-native-terra-ui.
4
+ ---
5
+
6
+ # Terra UI
7
+
8
+ `react-native-terra-ui` is a themed React Native component library built on Unistyles v3.
9
+
10
+ **This skill ships inside the package**, so it describes the version you have installed.
11
+ Check it with `node -p "require('react-native-terra-ui/package.json').version"`.
12
+
13
+ **Do not guess prop names.** The package publishes both `src` and TypeScript
14
+ declarations, so the real props are on disk — read
15
+ `node_modules/react-native-terra-ui/lib/typescript/src/components/<name>/` or the `src`
16
+ next to it. Every prop carries a JSDoc line with its default. This skill deliberately does
17
+ not restate props, because a copy would drift from the types.
18
+
19
+ ## Before You Write A Screen
20
+
21
+ Four things break most often, in this order:
22
+
23
+ 1. **Expo Go does not work.** Unistyles v3 needs native modules — use a development build
24
+ (`npx expo run:ios`, or an EAS dev client). If components render unstyled or the app
25
+ crashes at startup, check this first.
26
+ 2. **The Babel plugin must list the library.** `react-native-unistyles/plugin` needs
27
+ `autoProcessImports: ['react-native-terra-ui']` so the library's own stylesheets are
28
+ processed, and `react-native-worklets/plugin` must be **last**. Without it, styles
29
+ freeze at whichever theme was active when they were created.
30
+ 3. **`TerraUIProvider` wraps the app once**, near the root. It supplies `SafeAreaProvider`
31
+ and accent state. It does **not** include `ToastProvider` — add that separately if you
32
+ use toasts.
33
+ 4. **Import order decides whether your theme config wins.** See below.
34
+
35
+ ## Import Order Is Load-Bearing
36
+
37
+ | Entry | Side effect |
38
+ |---|---|
39
+ | `react-native-terra-ui/theme` | none — safe anywhere |
40
+ | `react-native-terra-ui` | auto-calls `configureTerraUI()` with defaults **if not already configured** |
41
+
42
+ So a custom theme must be configured *before* the first root-entry import. The pattern:
43
+
44
+ ```ts
45
+ // terra-ui.ts — imports from /theme only, so it has no side effects of its own
46
+ import { configureTerraUI, type TerraTheme } from 'react-native-terra-ui/theme';
47
+
48
+ declare module 'react-native-unistyles' {
49
+ interface UnistylesThemes { light: TerraTheme; dark: TerraTheme }
50
+ }
51
+
52
+ configureTerraUI({ /* shared, accents, defaultAccent, icons, image, components */ });
53
+ ```
54
+
55
+ ```js
56
+ // index.js — the bootstrap goes FIRST
57
+ import './terra-ui';
58
+ import 'expo-router/entry';
59
+ ```
60
+
61
+ Get this wrong and there is no error — the defaults silently win. If your fonts, accent, or
62
+ component defaults appear to be ignored, this is why.
63
+
64
+ Skip all of it if the default theme is fine; just wrap in `TerraUIProvider`.
65
+
66
+ ## Styling Rules
67
+
68
+ Styles must go through Unistyles, not React Native's `StyleSheet`:
69
+
70
+ ```tsx
71
+ import { StyleSheet } from 'react-native-unistyles'; // ✅ not from 'react-native'
72
+
73
+ const styles = StyleSheet.create((theme, rt) => ({
74
+ card: {
75
+ backgroundColor: theme.color['surface.default'], // flat, dotted keys
76
+ padding: theme.spacing['4'], // string keys, 4dp base
77
+ borderRadius: theme.radius.md,
78
+ paddingTop: rt.insets.top,
79
+ },
80
+ }));
81
+ ```
82
+
83
+ - **Colors are flat dotted string keys** — `theme.color['surface.default']`,
84
+ `theme.color['status.danger.fg']`. The one exception is `theme.color.background`.
85
+ - Semantic tokens only. There is no palette export — that is deliberate.
86
+ - Put theme and variant decisions **inside** `StyleSheet.create`. Do not destructure
87
+ `theme` from `useUnistyles()` to build a style object; it defeats the native styling
88
+ path and stops updating on theme change.
89
+ - Use `variants` / `compoundVariants` rather than conditional style arrays.
90
+ - Runtime values (`insets`, screen size) come from the second `(theme, rt)` argument, never
91
+ `Dimensions.get()`. No breakpoints are configured by default.
92
+ - Outside a stylesheet, turn a token into a color with
93
+ `resolveThemeColor(token, theme)` from `react-native-terra-ui/theme`. It passes raw
94
+ literals (`#7c3aed`, `rgba(…)`, `transparent`) straight through.
95
+
96
+ ## Choosing A Component
97
+
98
+ | Need | Use | Not |
99
+ |---|---|---|
100
+ | A screen container with margins + background | `Screen` | a bare `View` |
101
+ | A scrolling screen body | `Screen.ScrollView` / `.FlatList` / `.FlashList` | a plain `ScrollView` — these reserve the header inset |
102
+ | A nav bar | `Screen.Header as={Header.Title}` (or `as={Header.LargeTitle}`) | a custom absolute view |
103
+ | Icon actions in a header | `Toolbar.Button`, grouped in `Toolbar.Group` | `Button` with `isIconOnly` |
104
+ | A labelled action | `Button` | `Toolbar.Button` |
105
+ | A tag / status pill | `Chip` | `Button variant="ghost"` |
106
+ | A plain themed box with token props | `Box` | `Surface`, unless you want its configured radius + elevation |
107
+ | An elevated card | `Surface` | `Box` + hand-rolled shadow |
108
+ | Text | `Text` with a `variant` | RN `Text` |
109
+
110
+ `Box` is the only family exposing token style props (`p`, `px`, `gap`, `bg`, `radius`,
111
+ `row`, `align`, `justify`, `flex`, `elevation`, …). `Surface` extends it minus `bg`.
112
+ Everything else takes explicit props.
113
+
114
+ `Screen.Header` is a **polymorphic marker slot**, not a wrapper. Render the header through
115
+ `as`, and any extra props forward to it:
116
+
117
+ ```tsx
118
+ <Screen.Header as={Header.LargeTitle} title="Library" caption="24 items" />
119
+ ```
120
+
121
+ Nesting the header as a child still works and appears throughout older code, but `as` is
122
+ the current form. Either way the slot must be a **direct** child of `Screen` — that is how
123
+ `Screen` detects a header and drops its top safe-area edge.
124
+
125
+ `Header.LargeTitle` collapses on scroll, so it also has to be paired with one of the
126
+ `Screen` scroll containers — it reads scroll position from their shared context.
127
+
128
+ ## Icons Are Registered By You
129
+
130
+ The library ships only eight semantic icons: `navigation.back`, `navigation.forward`,
131
+ `navigation.close`, `status.info`, `status.success`, `status.warning`, `status.danger`,
132
+ `person`.
133
+
134
+ Everything else is yours, registered by name through declaration merging plus the `icons`
135
+ map. Both halves are required — types alone will not render, and a name that is not
136
+ registered logs a dev warning and renders **nothing**:
137
+
138
+ ```ts
139
+ // terra-ui-icons.d.ts
140
+ import type { TerraIconComponent } from 'react-native-terra-ui/theme';
141
+
142
+ declare global {
143
+ namespace TerraUI {
144
+ interface IconRegistry { add: TerraIconComponent; share: TerraIconComponent }
145
+ }
146
+ }
147
+ declare module 'react-native-terra-ui/theme' {
148
+ interface TerraIconRegistry extends TerraUI.IconRegistry {}
149
+ }
150
+ declare module 'react-native-terra-ui' {
151
+ interface TerraIconRegistry extends TerraUI.IconRegistry {}
152
+ }
153
+ ```
154
+
155
+ ```ts
156
+ // in configureTerraUI
157
+ import { Plus, Share } from 'lucide-react-native';
158
+ configureTerraUI({ icons: { add: Plus, share: Share } });
159
+ ```
160
+
161
+ If an icon is invisible, check that it is in **both** places.
162
+
163
+ ## Theme Switching
164
+
165
+ Runtime switching goes through the library, not React state:
166
+
167
+ ```tsx
168
+ const { theme, scheme, setScheme, accent, setAccent } = useTheme(); // under TerraUIProvider
169
+ ```
170
+
171
+ `setScheme` disables system-adaptive theming. `setAccent` takes a name registered in
172
+ `configureTerraUI({ accents })`. Re-rendering a provider with a different theme object is
173
+ not how this works — Unistyles resolves styles natively.
174
+
175
+ ## Compound Components
176
+
177
+ Sub-components hang off the parent: `Screen.Header` / `.ScrollView` / `.FlatList` /
178
+ `.FlashList`, `Header.Title` / `.LargeTitle`, `Button.Icon` / `.Label`,
179
+ `Chip.Icon`, `Toast.Title` / `.Description` / `.Action` / `.Close` / `.Icon`,
180
+ `Toolbar.Group` / `.Button`, `Portal.Provider` / `.Host`.
181
+
182
+ They inherit color and size from the parent through context, so
183
+ `<Chip color="success"><Chip.Icon name="status.success" />Done</Chip>` needs no color on
184
+ the icon. An explicit prop on the child always wins.
185
+
186
+ Content goes through `children`, not `label`/`icon`/`items` props. Text children are
187
+ auto-wrapped in themed `Text` where the component supports a label.
188
+
189
+ ## References
190
+
191
+ - `references/recipes.md` — working screen, header, toolbar, list, and toast snippets.
192
+ - `references/troubleshooting.md` — symptom → cause for the failures above.
193
+ - Full guide: https://github.com/earthling-std/react-native-terra-ui#readme
@@ -0,0 +1,198 @@
1
+ # Recipes
2
+
3
+ Read the component's types before adapting these — the props are on disk under
4
+ `node_modules/react-native-terra-ui/lib/typescript/src/components/`.
5
+
6
+ ## App Root
7
+
8
+ ```tsx
9
+ // index.js
10
+ import './terra-ui'; // configureTerraUI, FIRST
11
+ import 'expo-router/entry';
12
+ ```
13
+
14
+ ```tsx
15
+ // app/_layout.tsx
16
+ import { TerraUIProvider, ToastProvider } from 'react-native-terra-ui';
17
+
18
+ export default function RootLayout() {
19
+ return (
20
+ <TerraUIProvider>
21
+ <ToastProvider>
22
+ <Stack screenOptions={{ headerShown: false }} />
23
+ </ToastProvider>
24
+ </TerraUIProvider>
25
+ );
26
+ }
27
+ ```
28
+
29
+ `TerraUIProvider` already renders `SafeAreaProvider`. Add your own only if something above
30
+ it needs insets. `ToastProvider` is separate and only needed if you use toasts.
31
+
32
+ ## A Screen With A Collapsing Header
33
+
34
+ The large title collapses as the scroll container moves, so the two must be paired.
35
+
36
+ ```tsx
37
+ import { Header, Screen, Text } from 'react-native-terra-ui';
38
+
39
+ export function LibraryScreen() {
40
+ return (
41
+ <Screen>
42
+ <Screen.Header as={Header.LargeTitle} title="Library" caption="24 items" />
43
+
44
+ <Screen.ScrollView>
45
+ <Text variant="body-md">Content starts below the bar automatically.</Text>
46
+ </Screen.ScrollView>
47
+ </Screen>
48
+ );
49
+ }
50
+ ```
51
+
52
+ `Screen.Header` is polymorphic: pass the header through `as` and its props flow straight
53
+ on. Older code nests the header as a child instead
54
+ (`<Screen.Header><Header.LargeTitle …/></Screen.Header>`); that still renders, but `as` is
55
+ the current form — prefer it.
56
+
57
+ The scroll containers reserve the header height plus the top safe-area inset as content
58
+ padding — do not add your own top padding for the header.
59
+
60
+ `margins` controls the screen's horizontal/vertical content margins
61
+ (`'all' | 'x' | 'y' | 'none'`, default `'all'`); set it on `Screen` or override per
62
+ container. For a full-bleed carousel use `margins="none"`.
63
+
64
+ ## A Compact Header With Actions
65
+
66
+ ```tsx
67
+ import { Header, Screen, Toolbar } from 'react-native-terra-ui';
68
+
69
+ <Screen.Header
70
+ as={Header.Title}
71
+ title="Album"
72
+ dismissAction="back"
73
+ onDismiss={() => router.back()}
74
+ RightToolbar={
75
+ <>
76
+ <Toolbar.Group>
77
+ <Toolbar.Button icon="add" accessibilityLabel="Add" onPress={add} />
78
+ <Toolbar.Button icon="download" accessibilityLabel="Save" onPress={save} />
79
+ </Toolbar.Group>
80
+ <Toolbar.Button icon="share" accessibilityLabel="Share" onPress={share} />
81
+ </>
82
+ }
83
+ />
84
+ ```
85
+
86
+ The header wraps the slot in a `Toolbar` row for you — pass `Toolbar.Group` /
87
+ `Toolbar.Button` children directly, not your own `Toolbar`.
88
+
89
+ `dismissAction` is `'back' | 'close' | 'none'`. Pass `navigation` (or `onDismiss`) so it
90
+ knows how to leave.
91
+
92
+ ## A Toolbar Outside A Header
93
+
94
+ Anywhere else, supply the row yourself:
95
+
96
+ ```tsx
97
+ <Toolbar style={{ position: 'absolute', right: 16, bottom: 24 }}>
98
+ <Toolbar.Group background="surface.raised">
99
+ <Toolbar.Button icon="add" accessibilityLabel="Add" onPress={add} />
100
+ </Toolbar.Group>
101
+ <Toolbar.Button icon="share" accessibilityLabel="Share" onPress={share} background="surface.raised" />
102
+ </Toolbar>
103
+ ```
104
+
105
+ One `Toolbar.Group` is one capsule. Items inside share it; a `Toolbar.Button` that is a
106
+ direct child of the row keeps its own circle. Text labels work too —
107
+ `<Toolbar.Button onPress={save}>Save</Toolbar.Button>` — and the cell grows to fit.
108
+
109
+ ## A List
110
+
111
+ ```tsx
112
+ <Screen>
113
+ <Screen.Header as={Header.LargeTitle} title="Inbox" />
114
+
115
+ <Screen.FlatList
116
+ data={items}
117
+ keyExtractor={(item) => item.id}
118
+ renderItem={({ item }) => <Row item={item} />}
119
+ loading={isLoading}
120
+ EmptyComponent={<EmptyState title="Nothing here yet" />}
121
+ />
122
+ </Screen>
123
+ ```
124
+
125
+ All three scroll containers share `loading`, `LoadingComponent`, `EmptyComponent`, and
126
+ `margins`. `loading` wins over `EmptyComponent` while data is in flight, so a first load
127
+ shows a spinner rather than an empty state. Use `Screen.FlashList` for long lists.
128
+
129
+ ## Toasts
130
+
131
+ ```tsx
132
+ import { Toast } from 'react-native-terra-ui';
133
+
134
+ Toast.show({ label: 'Saved', variant: 'success' });
135
+ ```
136
+
137
+ Imperative statics — no hook needed at the call site, but `ToastProvider` must be mounted.
138
+ `useToast()` is there if you need the queue. The headline field is `label`, not `title`;
139
+ `ToastShowConfig` also takes `description`, `icon`, `actionLabel`, `onActionPress`,
140
+ `duration` (a number or `'persistent'`), `placement`, and `showCloseButton`.
141
+
142
+ ## Themed Styles
143
+
144
+ ```tsx
145
+ import { StyleSheet } from 'react-native-unistyles';
146
+
147
+ const styles = StyleSheet.create((theme, rt) => ({
148
+ card: {
149
+ backgroundColor: theme.color['surface.raised'],
150
+ borderRadius: theme.radius.lg,
151
+ padding: theme.spacing['4'],
152
+ gap: theme.spacing['2'],
153
+ marginBottom: rt.insets.bottom,
154
+ variants: {
155
+ emphasis: {
156
+ default: {},
157
+ strong: { borderWidth: 1, borderColor: theme.color['border.strong'] },
158
+ },
159
+ },
160
+ },
161
+ }));
162
+
163
+ // in the component
164
+ styles.useVariants({ emphasis });
165
+ <View style={styles.card} />
166
+ ```
167
+
168
+ ## Token Props Without A Stylesheet
169
+
170
+ For simple layout, `Box` avoids a stylesheet entirely:
171
+
172
+ ```tsx
173
+ <Box row align="center" justify="between" gap="3" p="4" bg="surface.default" radius="lg">
174
+ <Text variant="label-md">Total</Text>
175
+ <Text variant="title-sm">$42</Text>
176
+ </Box>
177
+ ```
178
+
179
+ `asChild` merges Box's props onto a single child instead of rendering a `View` — useful for
180
+ router links:
181
+
182
+ ```tsx
183
+ <Link href="/settings" asChild>
184
+ <Button variant="outline">Settings</Button>
185
+ </Link>
186
+ ```
187
+
188
+ ## Theme Toggle
189
+
190
+ ```tsx
191
+ const { scheme, setScheme, accent, setAccent } = useTheme();
192
+
193
+ <Button onPress={() => setScheme(scheme === 'dark' ? 'light' : 'dark')}>
194
+ {scheme === 'dark' ? 'Light' : 'Dark'}
195
+ </Button>
196
+ ```
197
+
198
+ `setAccent('brand')` needs `brand` registered in `configureTerraUI({ accents })`.