uitheme-rn 1.0.0 → 1.0.2-next.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.
package/README.md CHANGED
@@ -1,107 +1,104 @@
1
1
  # uitheme-rn
2
2
 
3
- Native appearance and independent color palettes for React Native. The provider
4
- and hooks have no Expo, DOM, CSS, Reanimated, or storage dependency. Optional
5
- controls in `uitheme-rn/expo` use SwiftUI on iOS and Jetpack Compose on Android.
3
+ uitheme-rn is UI-Theme for React Native. It brings light and dark mode support
4
+ to Android and iOS, and also support for color themes, so that apps can use
5
+ several design systems along with theme transitions. uitheme-rn comes with
6
+ native pickers for Android and iOS.
7
+
8
+ - Light, dark and system modes, plus palettes that work on top of either
9
+ - Nine full-screen transitions: fade, circular reveal, wipe, slide, split,
10
+ heart, star, pixelize and dissolve
11
+ - Smooth color changes on any view with Reanimated
12
+ - Native SwiftUI and Jetpack Compose pickers through Expo UI
13
+ - Works with plain `StyleSheet`, NativeWind 5 or Uniwind
14
+ - Remembers the choice with any storage you already use
15
+ - Respects Reduce Motion
16
+ - The core has no Expo, Reanimated or storage dependency
6
17
 
7
18
  ## Install
8
19
 
9
20
  ```sh
10
- pnpm add uitheme-rn@alpha
11
- # Optional native controls in an Expo SDK 56 or 57 app:
12
- npx expo install @expo/ui
21
+ npm install uitheme-rn
13
22
  ```
14
23
 
15
- Version `0.1.0-alpha` is intended for early testing. Device validation is still
16
- in progress.
17
- The reference app uses SDK 57, React 19.2.3, and React Native 0.86.3. The declared
18
- React Native range begins at 0.83; older versions in that range still need device
19
- verification. Expo is required only for the `/expo` entry point.
24
+ Want the native pickers? Add Expo UI too:
25
+
26
+ ```sh
27
+ npx expo install @expo/ui
28
+ ```
20
29
 
21
- Animation peers are restricted to Reanimated 4.5.x, Worklets 0.10.x, and Skia
22
- 2.11.x. These ranges prevent npm from selecting incompatible animation engines.
23
- NativeWind support targets exactly `5.0.0-rc.0`. Newer engine versions need a
24
- separate compatibility check. See
25
- [the release review](https://github.com/tonyedgal/ui-theme/blob/main/docs/native-stable-release-readiness.md) for the current
26
- validation scope and remaining gates.
30
+ ## Use
27
31
 
28
- ## Provider
32
+ Wrap your app in the provider, then read the colors anywhere:
29
33
 
30
34
  ```tsx
35
+ import { Pressable, Text, View } from 'react-native';
31
36
  import { UIThemeProvider, useUITheme } from 'uitheme-rn';
32
- import { UIThemeSelector, UIColorThemeSelector } from 'uitheme-rn/expo';
33
- import Storage from 'expo-sqlite/kv-store';
34
37
 
35
38
  export default function App() {
36
39
  return (
37
- <UIThemeProvider storage={Storage} fallback={null}>
38
- <Settings />
40
+ <UIThemeProvider>
41
+ <Home />
39
42
  </UIThemeProvider>
40
43
  );
41
44
  }
42
45
 
43
- function Settings() {
46
+ function Home() {
47
+ const { colors, toggleTheme } = useUITheme();
48
+
44
49
  return (
45
- <>
46
- <UIThemeSelector />
47
- <UIColorThemeSelector />
48
- </>
50
+ <View style={{ flex: 1, backgroundColor: colors.background }}>
51
+ <Pressable onPress={toggleTheme}>
52
+ <Text style={{ color: colors.text }}>Toggle theme</Text>
53
+ </Pressable>
54
+ </View>
49
55
  );
50
56
  }
51
57
  ```
52
58
 
53
- Install example storage with `npx expo install expo-sqlite`. Storage is optional.
54
- Without an adapter, preferences remain in memory. An adapter needs `getItem`
55
- and `setItem`; each may be synchronous or asynchronous. AsyncStorage also
56
- implements this contract. For MMKV, map `getString(key) ?? null` and `set(key, value)`.
57
- Theme preferences are not secrets and do not need SecureStore.
59
+ That's it. Every palette gives you `background`, `surface`, `text`,
60
+ `secondaryText`, `separator`, `accent` and `onAccent`, in light and dark.
58
61
 
59
- `fallback` is optional. Omit it to render defaults during restoration; pass
60
- `null` to delay the app and retain your launch screen until preferences restore.
61
- Call `SplashScreen.hideAsync()` in a mounted descendant after `isHydrated` is
62
- true, as the reference app does. A failed storage read also completes hydration.
62
+ ## Remember the choice
63
63
 
64
- Provider options are captured on mount. Change the provider's `key` to replace
65
- palettes, storage, defaults, or the error handler. Each provider owns its state.
66
- The package never overrides the app-wide `Appearance` setting.
67
-
68
- ## State and actions
64
+ Pass any storage with `getItem` and `setItem`. AsyncStorage, MMKV and Expo's
65
+ key-value store all work:
69
66
 
70
67
  ```tsx
71
- const {
72
- theme, // 'system' | 'light' | 'dark': user preference
73
- resolvedTheme, // 'light' | 'dark': currently displayed mode
74
- systemTheme,
75
- colorTheme,
76
- colors,
77
- palettes,
78
- colorThemes,
79
- isHydrated,
80
- setTheme,
81
- setColorTheme,
82
- toggleTheme,
83
- toggleColorTheme,
84
- flush,
85
- } = useUITheme();
68
+ import Storage from 'expo-sqlite/kv-store';
69
+
70
+ <UIThemeProvider storage={Storage} fallback={null}>
71
+ <App />
72
+ </UIThemeProvider>;
86
73
  ```
87
74
 
88
- `setTheme('system')` follows React Native Appearance updates. `toggleTheme()`
89
- selects the opposite of the resolved mode and leaves system mode. Palettes do
90
- not change when appearance changes. Setters update synchronously and reject
91
- unknown choices. `flush()` waits for restoration and queued writes; storage
92
- failures reach `onStorageError` while in-memory changes stay usable. Setters do
93
- not await disk or pretend to run a browser-style transition.
75
+ `fallback={null}` holds rendering until the saved theme loads, so your splash
76
+ screen stays up and nothing flickers. Without storage, the choice lives in
77
+ memory.
78
+
79
+ ## Native pickers
94
80
 
95
- The store persists a versioned record under `uitheme-rn:preferences`, configurable
96
- with `storageKey`. Unknown versions and invalid fields fall back to defaults.
97
- User input wins over a late read, independently for each preference. Writes
98
- are serialized. Call `flush()` before an app-owned shutdown flow when possible;
99
- JavaScript cannot guarantee a write completes after the OS kills the process.
81
+ Drop in real platform controls. They're SwiftUI on iOS and Jetpack Compose on
82
+ Android:
100
83
 
101
- ## Palettes and tokens
84
+ ```tsx
85
+ import {
86
+ UIThemeSelector,
87
+ UIColorThemeSelector,
88
+ UIThemeSwitcher,
89
+ } from 'uitheme-rn/expo';
90
+
91
+ <UIThemeSelector />;
92
+ <UIColorThemeSelector />;
93
+ <UIThemeSwitcher />;
94
+ ```
95
+
96
+ ## Add your own palettes
97
+
98
+ Start from the defaults and change what you need:
102
99
 
103
100
  ```tsx
104
- import { defaultPalettes, type ThemePalette } from 'uitheme-rn';
101
+ import { defaultPalettes } from 'uitheme-rn';
105
102
 
106
103
  const palettes = {
107
104
  ...defaultPalettes,
@@ -110,46 +107,19 @@ const palettes = {
110
107
  light: { ...defaultPalettes.default.light, accent: '#216E46' },
111
108
  dark: { ...defaultPalettes.default.dark, accent: '#80D6A5' },
112
109
  },
113
- } satisfies Record<string, ThemePalette>;
114
- ```
115
-
116
- Pass `palettes` and optionally `defaultColorTheme` to the provider. Without an
117
- explicit default, the first palette is used. Each palette supplies `background`,
118
- `surface`, `text`, `secondaryText`, `separator`, `accent`, and `onAccent` in both
119
- modes. Values are React Native `ColorValue`; opaque platform colors are accepted.
120
- Explicit mode colors are useful when the app's mode differs from the OS.
121
- Platform semantic colors follow the native host's appearance, so coordinate
122
- them with app-wide appearance if using them outside an Expo UI Host.
123
-
124
- `themeTokens` supplies a 4-point spacing scale, continuous corner radii, and
125
- system-font text styles. Text still scales with the device. `useThemeColors()`
126
- returns the active palette. Custom app-specific tokens belong in the app's
127
- theme module, composed with these tokens.
128
-
129
- ## Native controls
130
-
131
- Each control owns an Expo UI Host with the resolved color scheme:
132
-
133
- - `UIThemeSelector`: appearance picker; supports `label`, translated `labels`,
134
- `disabled`, and `testID`.
135
- - `UIColorThemeSelector`: palette picker with palette labels; supports `label`,
136
- `disabled`, and `testID`.
137
- - `UIThemeSwitcher`: native button for light/dark; supports `label` and `disabled`.
110
+ };
138
111
 
139
- For custom settings composition, use `useUITheme()` with your own `@expo/ui`
140
- controls. Native control feedback and navigation transitions stay platform-owned.
141
- The root and Expo entries do not mount snapshots or duplicate screen trees.
142
- Screen snapshots are opt-in through the separate transition entry.
143
- `useReducedMotion()` observes the accessibility setting and starts conservatively
144
- enabled until the first native query finishes. Use it for custom app motion.
112
+ <UIThemeProvider palettes={palettes}>
113
+ <App />
114
+ </UIThemeProvider>;
115
+ ```
145
116
 
146
- For headless integrations, `uitheme-rn/core` exports `createThemeStore` and its
147
- types without importing React Native. The React provider subscribes with
148
- `useSyncExternalStore`.
117
+ Then switch with `setColorTheme('forest')`. The palette stays the same when the
118
+ mode changes.
149
119
 
150
- ## Optional theme transitions
120
+ ## Animate the colors
151
121
 
152
- Install the SDK-compatible animation peers in an Expo app:
122
+ Install Reanimated, then spread the transition styles onto any animated view:
153
123
 
154
124
  ```sh
155
125
  npx expo install react-native-reanimated react-native-worklets
@@ -166,238 +136,105 @@ function Card() {
166
136
 
167
137
  return (
168
138
  <Animated.View
169
- style={{
170
- ...transition.view,
171
- backgroundColor: colors.surface,
172
- borderColor: colors.separator,
173
- borderWidth: 1,
174
- padding: 16,
175
- }}
139
+ style={{ ...transition.view, backgroundColor: colors.surface }}
176
140
  >
177
141
  <Animated.Text style={{ ...transition.text, color: colors.text }}>
178
- Your theme, on your device.
142
+ Hello
179
143
  </Animated.Text>
180
144
  </Animated.View>
181
145
  );
182
146
  }
183
147
  ```
184
148
 
185
- `useThemeTransition()` returns `view` and `text` styles. View styles transition
186
- background and border colors. Text styles also transition text color. Each uses
187
- 180 ms and an ease-out curve. Apply the styles to Reanimated components; ordinary
188
- React Native components cannot run these transitions. Existing screens opt in
189
- without changing their tree, scroll position, or focus.
190
-
191
- The hook arms after the hydrated colors commit to a frame. Mounting and preference
192
- restoration stay immediate. Live Reduce Motion changes remove the transition
193
- configuration and apply the final colors. Rapid changes are handled by
194
- Reanimated's transition engine; there is no completion callback that can restore
195
- an old preference. Setters and persistence remain synchronous and independent
196
- of animation completion. Unmounting cancels the pending frame used to arm motion.
197
-
198
- Interpolating light and dark text against an interpolating background can briefly
199
- reduce contrast. The recorded example shows this in intermediate frames. For
200
- screens that need continuous reading, apply `transition.view` to surfaces and
201
- set text colors immediately. Text transitions are opt-in through `transition.text`.
202
-
203
- Use explicit string colors for predictable interpolation. Native semantic colors
204
- remain useful for platform-owned controls; do not assume their internal appearance
205
- animates through these styles. Expo UI Hosts, native navigation headers, and status
206
- bars update to the resolved theme through their own APIs. The reference app keeps
207
- those native elements outside the Reanimated color transition.
208
-
209
- The animation entry requires the New Architecture, Reanimated 4.5.1 and compatible
210
- Worklets. The reference app verifies the SDK 57 pair, Reanimated 4.5.1 and Worklets
211
- 0.10.1. Bare React Native apps must configure the Worklets Babel plugin as described
212
- in Reanimated's installation guide. The root, core, and Expo entries do not import
213
- animation peers.
214
-
215
- See [the transition acceptance cases](../../apps/examples/example-expo/TRANSITION-CHECKS.md)
216
- and [the recorded checks](../../apps/examples/example-expo/VERIFICATION.md).
217
-
218
- ## Workspace verification
149
+ Backgrounds, borders and text fade to the new theme. Your screens keep their
150
+ scroll position and focus.
219
151
 
220
- ```sh
221
- pnpm --filter uitheme-rn test
222
- pnpm --filter uitheme-rn typecheck
223
- pnpm --filter uitheme-rn build
224
- pnpm --filter uitheme-rn test:package
225
- pnpm --filter example-expo typecheck
226
- pnpm --filter example-expo start
227
- ```
228
-
229
- Use a release build on the slowest supported device to judge native feel. See
230
- the example README for the native acceptance checklist and repeatable flows.
152
+ ## Full-screen transitions
231
153
 
232
- ## Screen transitions
154
+ Want the whole screen to change at once? Add Skia, and wrap your app in the
155
+ transition provider:
233
156
 
234
- For the screen effects shown in the
235
- [reference Snack](https://snack.expo.dev/@mariops03/react-native-theme-transition?platform=ios),
236
- use the optional `uitheme-rn/transitions` entry. Install SDK-compatible Skia,
237
- Reanimated, and Worklets through Expo. Pin Skia to `2.11.1` or a supported
238
- 2.11 patch release; SDK 57's bundled Skia 2.6.2 has a broken Android overflow
239
- capture path. This override requires a custom native build and does not claim
240
- Expo Go compatibility. See the
241
- [upstream fix](https://github.com/wcandillon/react-native-skia/pull/4004). The tested pair uses Skia 2.11.1,
242
- Reanimated 4.5.1, and Worklets 0.10.1 on Expo SDK 57.
157
+ ```sh
158
+ npx expo install @shopify/react-native-skia react-native-reanimated react-native-worklets
159
+ ```
243
160
 
244
161
  ```tsx
245
- import { Button, View } from 'react-native';
246
- import { UIThemeProvider, defaultPalettes } from 'uitheme-rn';
162
+ import { Button } from 'react-native';
163
+ import { UIThemeProvider } from 'uitheme-rn';
247
164
  import {
248
165
  UIThemeTransitionProvider,
249
166
  useAnimatedUITheme,
250
167
  } from 'uitheme-rn/transitions';
251
168
 
252
- const palettes = {
253
- ...defaultPalettes,
254
- forest: {
255
- label: 'Forest',
256
- light: { ...defaultPalettes.default.light, accent: '#216E46' },
257
- dark: { ...defaultPalettes.default.dark, accent: '#80D6A5' },
258
- },
259
- };
260
-
261
169
  export default function App() {
262
170
  return (
263
- <UIThemeProvider palettes={palettes}>
171
+ <UIThemeProvider>
264
172
  <UIThemeTransitionProvider defaults={{ transition: 'circularReveal' }}>
265
- <Controls />
173
+ <Home />
266
174
  </UIThemeTransitionProvider>
267
175
  </UIThemeProvider>
268
176
  );
269
177
  }
270
178
 
271
- function Controls() {
179
+ function Home() {
272
180
  const { setTheme, setColorTheme, isTransitioning } = useAnimatedUITheme();
273
181
 
274
182
  return (
275
- <View>
183
+ <>
276
184
  <Button
277
185
  title="Dark mode"
278
186
  disabled={isTransitioning}
279
- onPress={() => {
280
- void setTheme('dark');
281
- }}
187
+ onPress={() => setTheme('dark')}
282
188
  />
283
189
  <Button
284
- title="Forest palette"
190
+ title="Forest"
285
191
  disabled={isTransitioning}
286
- onPress={() => {
287
- void setColorTheme('forest', { transition: 'wipe' });
288
- }}
192
+ onPress={() => setColorTheme('forest', { transition: 'heart' })}
289
193
  />
290
- </View>
194
+ </>
291
195
  );
292
196
  }
293
197
  ```
294
198
 
295
- Both commands capture the provider's native view tree before changing the same
296
- preference store. The overlay paints the old screen before the new screen commits.
297
- Skia captures the new screen, and a Reanimated shared value drives the shader on
298
- the UI runtime. Participating text does not interpolate its individual colors.
299
- Do not combine this provider with per-element color interpolation on the same tree.
300
-
301
- Available effects are `fade`, `circularReveal`, `wipe`, `slide`, `split`, `heart`,
302
- `star`, `pixelize`, and `dissolve`. Options include `duration`, `origin` (a view ref
303
- or a provider-relative point), `inverted` for shape/split reveals, `direction`,
304
- `split`, `blockSize`, `noiseSize`, and `animated`. The default duration is 350 ms.
305
- Busy requests are rejected before preferences change. Immediate root commands
306
- remain available through `useUITheme`; use the animated hook for screen effects.
307
- Expo selectors accept `onValueChange`, and the switcher accepts `onPress`, so the
308
- native controls can call animated commands without taking ownership of preferences.
309
-
310
- Reduce Motion skips capture. Live Reduce Motion, backgrounding, rotation, and
311
- unmount cancel the overlay. A capture failure falls back to an immediate change;
312
- `onError` reports it. Restoration and system appearance updates use the existing
313
- provider and do not trigger screen captures. Snapshot layers are hidden from the
314
- accessibility tree. Touch input is blocked while capture/playback is active.
315
-
316
- Set the transition provider's `enabled` prop to `false` while native navigation
317
- or another movement changes the captured tree. This cancels an active overlay and
318
- applies new choices immediately. Re-enable when movement ends. The Expo example
319
- connects this prop to the stack's `transitionStart` and `transitionEnd` events.
320
- Commands also skip capture while the app is not active.
321
-
322
- The capture boundary is the provider's view tree, including navigation inside it.
323
- System status bars, keyboards, alerts, and separate native windows remain under OS
324
- control. Two screen images require memory proportional to their pixel dimensions.
325
- Run [SCREEN-TRANSITION-CHECKS.md](./SCREEN-TRANSITION-CHECKS.md) before claiming
326
- release performance or accessibility verification.
327
-
328
- The browser fallback changes preferences immediately; it does not mount Skia or
329
- require CanvasKit initialization. Native screen effects target iOS and Android.
330
-
331
- ## Styling systems and CSS themes
332
-
333
- Plain `StyleSheet`, inline native styles, and TypeScript palettes remain the
334
- base API. Neither Tailwind nor a styling engine is required by the root entry.
335
- Optional `uitheme-rn/nativewind` and `uitheme-rn/uniwind` adapters connect utility
336
- classes to the same appearance and palette store. Install one engine in an app.
337
-
338
- The NativeWind example targets `nativewind@5.0.0-rc.0` and
339
- `react-native-css@3.1.0-rc.0` with Tailwind 4.3.1. NativeWind v5 is a release
340
- candidate; v4 is not supported by this adapter. The Uniwind example targets
341
- Uniwind 1.12.2 with Tailwind 4.3.1. Follow each example's Metro configuration;
342
- NativeWind also needs the Tailwind v4 PostCSS plugin and Lightning CSS 1.30.1.
343
-
344
- For existing TypeScript palettes, place `<NativeWindTheme>` or `<UniwindTheme>`
345
- inside `<UIThemeProvider>`. The adapter provides scoped semantic variables.
346
- `bg-primary`, `text-primary-foreground`, `bg-card`, `bg-background`,
347
- `text-foreground`, `text-muted-foreground`, and `border-border` then use the
348
- same colors as `useThemeColors()`. Native dynamic color objects remain available
349
- with native styles; CSS conversion requires string colors.
350
-
351
- For CSS-authored palettes, use label-only metadata and map each palette's modes:
199
+ Pick any of the nine effects per call, and tune `duration`, `origin` and
200
+ `direction`. With Reduce Motion on, the theme changes at once.
201
+
202
+ ## Using NativeWind or Uniwind?
203
+
204
+ Put the adapter inside the provider, and your utility classes follow the theme:
352
205
 
353
206
  ```tsx
354
- import { UIThemeProvider } from 'uitheme-rn';
355
207
  import { NativeWindTheme } from 'uitheme-rn/nativewind';
356
208
 
357
- const palettes = { supabase: { label: 'Supabase' } };
358
- const themes = {
359
- supabase: { light: 'supabase-light', dark: 'supabase-dark' },
360
- };
361
-
362
- <UIThemeProvider palettes={palettes} defaultColorTheme="supabase">
363
- <NativeWindTheme themes={themes}>{/* Your app */}</NativeWindTheme>
209
+ <UIThemeProvider>
210
+ <NativeWindTheme>
211
+ <App />
212
+ </NativeWindTheme>
364
213
  </UIThemeProvider>;
365
214
  ```
366
215
 
367
- For Uniwind, use `<UniwindTheme themes={themes}>` and register the selected names
368
- in Metro's `extraThemes`. NativeWind uses CSS class names. Uniwind uses scoped
369
- registered themes. Both adapters resolve seven colors from CSS for native
370
- controls and hooks. Missing variables or mappings produce a useful error.
371
-
372
- The examples preserve the Next app's raw names (`--background`, `--primary`,
373
- etc.) and Tailwind v4 aliases (`--color-background`, `--color-primary`, etc.).
374
- All 32 color tokens, including chart and sidebar colors, are available to
375
- utility classes. The native `ThemeColors` contract maps its `accent` to the
376
- primary action color (`--color-primary`); the separate CSS `--color-accent`
377
- remains available for accent surfaces.
378
-
379
- The six example palettes come from `example-next/app/globals.css`: Default,
380
- Supabase, Mono, Caffeine, Mocha, and Perpetuity. Run `pnpm sync:colors` inside
381
- either styling example after changing the web colors. The sync script copies
382
- OKLCH values without translating or inventing palette values. Web layout,
383
- fonts, shadows, and animation rules remain in the web stylesheet.
384
-
385
- Place `UIThemeTransitionProvider` inside the styling adapter so captures see the
386
- resolved CSS scope. Use `useAnimatedUITheme()` for animated appearance and
387
- palette commands. Semantic colors follow the provider's resolved mode without
388
- changing OS Appearance. NativeWind's global `dark:` variant still follows the
389
- engine's system appearance; use semantic colors for provider-owned palettes.
390
-
391
- ## Snapshot performance and native surfaces
392
-
393
- Screen effects take two snapshots of the provider's content. On the tested
394
- Android flagship, each awaited view capture takes 113–133 ms. Capture can pause
395
- the UI before the shader animation begins. Reanimated color transitions avoid
396
- this snapshot path. Do not assume full-screen effects meet the same frame budget.
397
-
398
- Disable snapshot transitions with `enabled={false}` around trees containing
399
- Android `SurfaceView` content, such as some video and camera views. The tested
400
- Skia capture path waits on the main thread for a callback scheduled on that
401
- same thread, which can time out and produce incomplete capture. Such trees are
402
- not verified for these effects. Keep system windows and native chrome outside
403
- the capture boundary. See the stable release review for current device limits.
216
+ `bg-background`, `text-foreground`, `bg-primary` and friends now use the same
217
+ colors as `useUITheme()`. For Uniwind, use `UniwindTheme` from
218
+ `uitheme-rn/uniwind`.
219
+
220
+ The guides cover the setup for
221
+ [NativeWind](https://www.ui-theme.dev/docs/guides/nativewind) and
222
+ [Uniwind](https://www.ui-theme.dev/docs/guides/uniwind), including palettes
223
+ written in CSS.
224
+
225
+ ## Good to know
226
+
227
+ - Full-screen transitions need a development build. They don't run in Expo Go.
228
+ - Turn them off with `enabled={false}` while a navigation animation runs, and
229
+ around Android `SurfaceView` content such as video or camera previews.
230
+ - The status bar, keyboard and alerts belong to the OS, so they aren't part of
231
+ the screen transition.
232
+ - The provider never changes the app-wide `Appearance` setting.
233
+
234
+ ## Documentation
235
+
236
+ Start with the [Expo guide](https://www.ui-theme.dev/docs/guides/expo).
237
+
238
+ ## License
239
+
240
+ MIT
package/dist/core.d.cts CHANGED
@@ -16,4 +16,5 @@ declare function createThemeStore(options: ThemeStoreOptions): {
16
16
  };
17
17
  type ThemeStore = ReturnType<typeof createThemeStore>;
18
18
 
19
- export { ResolvedTheme, Theme, ThemeSnapshot, type ThemeStore, ThemeStoreOptions, createThemeStore, isTheme };
19
+ export { ResolvedTheme, Theme, ThemeSnapshot, ThemeStoreOptions, createThemeStore, isTheme };
20
+ export type { ThemeStore };
package/dist/core.d.ts CHANGED
@@ -16,4 +16,5 @@ declare function createThemeStore(options: ThemeStoreOptions): {
16
16
  };
17
17
  type ThemeStore = ReturnType<typeof createThemeStore>;
18
18
 
19
- export { ResolvedTheme, Theme, ThemeSnapshot, type ThemeStore, ThemeStoreOptions, createThemeStore, isTheme };
19
+ export { ResolvedTheme, Theme, ThemeSnapshot, ThemeStoreOptions, createThemeStore, isTheme };
20
+ export type { ThemeStore };
package/dist/expo.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { b as Theme } from './types-BkuOLauF.cjs';
2
+ import { Theme } from './core.cjs';
3
3
 
4
4
  interface UIThemeSelectorProps {
5
5
  label?: string;
@@ -19,4 +19,5 @@ declare function UIThemeSwitcher({ disabled, label, onPress, }: {
19
19
  onPress?: () => void;
20
20
  }): react.JSX.Element;
21
21
 
22
- export { UIColorThemeSelector, UIThemeSelector, type UIThemeSelectorProps, UIThemeSwitcher };
22
+ export { UIColorThemeSelector, UIThemeSelector, UIThemeSwitcher };
23
+ export type { UIThemeSelectorProps };
package/dist/expo.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { b as Theme } from './types-BkuOLauF.js';
2
+ import { Theme } from './core.js';
3
3
 
4
4
  interface UIThemeSelectorProps {
5
5
  label?: string;
@@ -19,4 +19,5 @@ declare function UIThemeSwitcher({ disabled, label, onPress, }: {
19
19
  onPress?: () => void;
20
20
  }): react.JSX.Element;
21
21
 
22
- export { UIColorThemeSelector, UIThemeSelector, type UIThemeSelectorProps, UIThemeSwitcher };
22
+ export { UIColorThemeSelector, UIThemeSelector, UIThemeSwitcher };
23
+ export type { UIThemeSelectorProps };
package/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { T as ThemeStoreOptions, b as Theme, R as ResolvedTheme } from './types-BkuOLauF.cjs';
3
+ import { b as Theme, R as ResolvedTheme } from './types-BkuOLauF.cjs';
4
+ import { ThemeStoreOptions } from './core.cjs';
4
5
  export { a as ThemeSnapshot, c as ThemeStorage } from './types-BkuOLauF.cjs';
5
6
  import { ColorValue } from 'react-native';
6
7
 
@@ -146,4 +147,5 @@ declare function toThemeVariables(colors: ThemeColors): {
146
147
  '--color-primary-foreground': string;
147
148
  };
148
149
 
149
- export { type CSSThemePalette, ResolvedTheme, Theme, type ThemeColors, type ThemePalette, type ThemePaletteDefinition, UIThemeColorsProvider, UIThemeProvider, type UIThemeProviderProps, defaultPalettes, themeTokens, themeVariableNames, toThemeVariables, useReducedMotion, useThemeColors, useUITheme };
150
+ export { ResolvedTheme, Theme, UIThemeColorsProvider, UIThemeProvider, defaultPalettes, themeTokens, themeVariableNames, toThemeVariables, useReducedMotion, useThemeColors, useUITheme };
151
+ export type { CSSThemePalette, ThemeColors, ThemePalette, ThemePaletteDefinition, UIThemeProviderProps };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { T as ThemeStoreOptions, b as Theme, R as ResolvedTheme } from './types-BkuOLauF.js';
3
+ import { b as Theme, R as ResolvedTheme } from './types-BkuOLauF.js';
4
+ import { ThemeStoreOptions } from './core.js';
4
5
  export { a as ThemeSnapshot, c as ThemeStorage } from './types-BkuOLauF.js';
5
6
  import { ColorValue } from 'react-native';
6
7
 
@@ -146,4 +147,5 @@ declare function toThemeVariables(colors: ThemeColors): {
146
147
  '--color-primary-foreground': string;
147
148
  };
148
149
 
149
- export { type CSSThemePalette, ResolvedTheme, Theme, type ThemeColors, type ThemePalette, type ThemePaletteDefinition, UIThemeColorsProvider, UIThemeProvider, type UIThemeProviderProps, defaultPalettes, themeTokens, themeVariableNames, toThemeVariables, useReducedMotion, useThemeColors, useUITheme };
150
+ export { ResolvedTheme, Theme, UIThemeColorsProvider, UIThemeProvider, defaultPalettes, themeTokens, themeVariableNames, toThemeVariables, useReducedMotion, useThemeColors, useUITheme };
151
+ export type { CSSThemePalette, ThemeColors, ThemePalette, ThemePaletteDefinition, UIThemeProviderProps };
@@ -1,5 +1,8 @@
1
1
  // src/nativewind.tsx
2
- import { useCallback, useState } from "react";
2
+ import {
3
+ useCallback,
4
+ useState
5
+ } from "react";
3
6
  import { z as z2 } from "zod";
4
7
  import { Platform, View } from "react-native";
5
8
  import {
@@ -8,4 +8,5 @@ interface ThemeTransitionStyles {
8
8
  /** Apply to Reanimated components alongside the current theme colors. */
9
9
  declare function useThemeTransition(): ThemeTransitionStyles;
10
10
 
11
- export { type ThemeTransitionStyles, useThemeTransition };
11
+ export { useThemeTransition };
12
+ export type { ThemeTransitionStyles };
@@ -8,4 +8,5 @@ interface ThemeTransitionStyles {
8
8
  /** Apply to Reanimated components alongside the current theme colors. */
9
9
  declare function useThemeTransition(): ThemeTransitionStyles;
10
10
 
11
- export { type ThemeTransitionStyles, useThemeTransition };
11
+ export { useThemeTransition };
12
+ export type { ThemeTransitionStyles };
@@ -118,7 +118,10 @@ half4 main(float2 xy) {
118
118
  `);
119
119
  var frame = () => new Promise((resolve) => requestAnimationFrame(() => resolve()));
120
120
  async function capture(ref) {
121
- const texture = await (0, import_react_native_skia.makeImageFromView)(ref);
121
+ const target = (0, import_react_native.findNodeHandle)(ref.current);
122
+ if (target === null || target === void 0)
123
+ throw new Error("Screen capture target is not mounted.");
124
+ const texture = await (0, import_react_native_skia.makeImageFromView)({ current: target });
122
125
  if (!texture) throw new Error("Screen capture returned no image.");
123
126
  try {
124
127
  const image = texture.makeNonTextureImage();
@@ -1,8 +1,8 @@
1
1
  import * as uitheme_rn from 'uitheme-rn';
2
2
  import * as react from 'react';
3
- import { RefObject, ReactNode } from 'react';
3
+ import { RefObject, ComponentRef, ReactNode } from 'react';
4
4
  import { View } from 'react-native';
5
- import { b as Theme } from './types-BkuOLauF.cjs';
5
+ import { Theme } from './core.cjs';
6
6
 
7
7
  declare const screenTransitionTypes: readonly ["fade", "circularReveal", "wipe", "slide", "split", "heart", "star", "pixelize", "dissolve"];
8
8
  type ScreenTransitionType = (typeof screenTransitionTypes)[number];
@@ -12,7 +12,7 @@ interface ScreenTransitionOptions {
12
12
  origin?: {
13
13
  x: number;
14
14
  y: number;
15
- } | RefObject<View | null>;
15
+ } | RefObject<ComponentRef<typeof View> | null>;
16
16
  inverted?: boolean;
17
17
  direction?: 'left' | 'right' | 'up' | 'down';
18
18
  split?: 'left-right' | 'top-bottom';
@@ -46,4 +46,5 @@ declare function useAnimatedUITheme(): {
46
46
  isHydrated: boolean;
47
47
  };
48
48
 
49
- export { type ScreenTransitionOptions, type ScreenTransitionType, UIThemeTransitionProvider, screenTransitionTypes, useAnimatedUITheme };
49
+ export { UIThemeTransitionProvider, screenTransitionTypes, useAnimatedUITheme };
50
+ export type { ScreenTransitionOptions, ScreenTransitionType };
@@ -1,8 +1,8 @@
1
1
  import * as uitheme_rn from 'uitheme-rn';
2
2
  import * as react from 'react';
3
- import { RefObject, ReactNode } from 'react';
3
+ import { RefObject, ComponentRef, ReactNode } from 'react';
4
4
  import { View } from 'react-native';
5
- import { b as Theme } from './types-BkuOLauF.js';
5
+ import { Theme } from './core.js';
6
6
 
7
7
  declare const screenTransitionTypes: readonly ["fade", "circularReveal", "wipe", "slide", "split", "heart", "star", "pixelize", "dissolve"];
8
8
  type ScreenTransitionType = (typeof screenTransitionTypes)[number];
@@ -12,7 +12,7 @@ interface ScreenTransitionOptions {
12
12
  origin?: {
13
13
  x: number;
14
14
  y: number;
15
- } | RefObject<View | null>;
15
+ } | RefObject<ComponentRef<typeof View> | null>;
16
16
  inverted?: boolean;
17
17
  direction?: 'left' | 'right' | 'up' | 'down';
18
18
  split?: 'left-right' | 'top-bottom';
@@ -46,4 +46,5 @@ declare function useAnimatedUITheme(): {
46
46
  isHydrated: boolean;
47
47
  };
48
48
 
49
- export { type ScreenTransitionOptions, type ScreenTransitionType, UIThemeTransitionProvider, screenTransitionTypes, useAnimatedUITheme };
49
+ export { UIThemeTransitionProvider, screenTransitionTypes, useAnimatedUITheme };
50
+ export type { ScreenTransitionOptions, ScreenTransitionType };
@@ -7,7 +7,13 @@ import {
7
7
  useRef,
8
8
  useState
9
9
  } from "react";
10
- import { AppState, Platform, StyleSheet, View } from "react-native";
10
+ import {
11
+ AppState,
12
+ Platform,
13
+ StyleSheet,
14
+ View,
15
+ findNodeHandle
16
+ } from "react-native";
11
17
  import {
12
18
  Canvas,
13
19
  Fill,
@@ -112,7 +118,10 @@ half4 main(float2 xy) {
112
118
  `);
113
119
  var frame = () => new Promise((resolve) => requestAnimationFrame(() => resolve()));
114
120
  async function capture(ref) {
115
- const texture = await makeImageFromView(ref);
121
+ const target = findNodeHandle(ref.current);
122
+ if (target === null || target === void 0)
123
+ throw new Error("Screen capture target is not mounted.");
124
+ const texture = await makeImageFromView({ current: target });
116
125
  if (!texture) throw new Error("Screen capture returned no image.");
117
126
  try {
118
127
  const image = texture.makeNonTextureImage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uitheme-rn",
3
- "version": "1.0.0",
3
+ "version": "1.0.2-next.0",
4
4
  "description": "Native appearance and color palettes for React Native and Expo",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -96,25 +96,15 @@
96
96
  ],
97
97
  "publishConfig": {
98
98
  "access": "public",
99
- "provenance": true,
100
- "tag": "alpha"
101
- },
102
- "scripts": {
103
- "build": "tsup",
104
- "dev": "tsup --watch",
105
- "typecheck": "tsc --noEmit",
106
- "lint": "eslint .",
107
- "test": "vitest run",
108
- "test:package": "node scripts/smoke-package.mjs",
109
- "prepublishOnly": "pnpm build && pnpm test:package"
99
+ "provenance": true
110
100
  },
111
101
  "peerDependencies": {
112
- "@expo/ui": ">=56.0.0 <58",
113
- "@shopify/react-native-skia": ">=2.11.1 <2.12",
102
+ "@expo/ui": ">=56.0.0 <59",
103
+ "@shopify/react-native-skia": ">=2.11.1 <2.15",
114
104
  "react": ">=19.2.0 <20",
115
- "react-native": ">=0.83.0 <0.87",
116
- "react-native-reanimated": ">=4.5.1 <4.6",
117
- "react-native-worklets": ">=0.10.1 <0.11",
105
+ "react-native": ">=0.83.0 <0.89",
106
+ "react-native-reanimated": ">=4.5.1 <4.8",
107
+ "react-native-worklets": ">=0.10.1 <0.14",
118
108
  "nativewind": "5.0.0-rc.0",
119
109
  "uniwind": ">=1.12.2 <2"
120
110
  },
@@ -139,23 +129,31 @@
139
129
  }
140
130
  },
141
131
  "devDependencies": {
142
- "@expo/ui": "~57.0.22",
143
- "@shopify/react-native-skia": "2.11.1",
144
- "@types/react": "~19.2.2",
145
- "@types/react-dom": "~19.2.2",
132
+ "@expo/ui": "~58.0.23",
133
+ "@shopify/react-native-skia": "2.14.0",
134
+ "@types/react": "~19.3.0",
135
+ "@types/react-dom": "~19.3.0",
146
136
  "nativewind": "5.0.0-rc.0",
147
- "react": "19.2.3",
148
- "react-dom": "19.2.3",
149
- "react-native": "0.86.3",
150
- "react-native-reanimated": "4.5.1",
151
- "react-native-worklets": "0.10.1",
137
+ "react": "19.3.0",
138
+ "react-dom": "19.3.0",
139
+ "react-native": "0.88.0",
140
+ "react-native-reanimated": "4.7.1",
141
+ "react-native-worklets": "0.13.0",
152
142
  "typescript": "~6.0.3",
153
- "uniwind": "1.12.2",
143
+ "uniwind": "1.13.0",
154
144
  "react-native-css": "3.1.0-rc.0",
155
- "tailwindcss": "4.3.1",
145
+ "tailwindcss": "4.3.3",
156
146
  "lightningcss": "1.30.1"
157
147
  },
158
148
  "dependencies": {
159
- "zod": "^4.6.5"
149
+ "zod": "^4.6.7"
150
+ },
151
+ "scripts": {
152
+ "build": "tsup",
153
+ "dev": "tsup --watch",
154
+ "typecheck": "tsc --noEmit",
155
+ "lint": "eslint .",
156
+ "test": "vitest run",
157
+ "test:package": "node scripts/smoke-package.mjs"
160
158
  }
161
- }
159
+ }