@retray-dev/ui-kit 7.0.1 → 9.0.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/COMPONENTS.md +554 -11
- package/EXAMPLES.md +2 -2
- package/README.md +14 -8
- package/dist/Accordion.js +57 -5
- package/dist/Accordion.mjs +4 -3
- package/dist/AlertBanner.js +4 -1
- package/dist/AlertBanner.mjs +3 -2
- package/dist/AppHeader.d.mts +40 -0
- package/dist/AppHeader.d.ts +40 -0
- package/dist/AppHeader.js +515 -0
- package/dist/AppHeader.mjs +10 -0
- package/dist/Avatar.js +39 -29
- package/dist/Avatar.mjs +2 -1
- package/dist/Badge.js +11 -1
- package/dist/Badge.mjs +2 -1
- package/dist/Button.d.mts +8 -3
- package/dist/Button.d.ts +8 -3
- package/dist/Button.js +126 -108
- package/dist/Button.mjs +6 -5
- package/dist/ButtonGroup.mjs +1 -0
- package/dist/Card.js +90 -70
- package/dist/Card.mjs +5 -4
- package/dist/CategoryStrip.js +79 -22
- package/dist/CategoryStrip.mjs +6 -6
- package/dist/Checkbox.js +118 -86
- package/dist/Checkbox.mjs +5 -5
- package/dist/Chip.js +113 -80
- package/dist/Chip.mjs +5 -5
- package/dist/ConfirmDialog.js +140 -110
- package/dist/ConfirmDialog.mjs +7 -6
- package/dist/CurrencyDisplay.mjs +1 -0
- package/dist/CurrencyInput.d.mts +1 -1
- package/dist/CurrencyInput.d.ts +1 -1
- package/dist/CurrencyInput.js +9 -5
- package/dist/CurrencyInput.mjs +5 -4
- package/dist/DetailRow.mjs +1 -0
- package/dist/EmptyState.js +131 -111
- package/dist/EmptyState.mjs +7 -6
- package/dist/ErrorBoundary.d.mts +42 -0
- package/dist/ErrorBoundary.d.ts +42 -0
- package/dist/ErrorBoundary.js +351 -0
- package/dist/ErrorBoundary.mjs +7 -0
- package/dist/Form.mjs +1 -0
- package/dist/HolographicCard.d.mts +55 -0
- package/dist/HolographicCard.d.ts +55 -0
- package/dist/HolographicCard.js +316 -0
- package/dist/HolographicCard.mjs +191 -0
- package/dist/IconButton.d.mts +8 -3
- package/dist/IconButton.d.ts +8 -3
- package/dist/IconButton.js +115 -98
- package/dist/IconButton.mjs +5 -4
- package/dist/ImageViewer.d.mts +23 -0
- package/dist/ImageViewer.d.ts +23 -0
- package/dist/ImageViewer.js +582 -0
- package/dist/ImageViewer.mjs +8 -0
- package/dist/Input.mjs +4 -3
- package/dist/LabelValue.mjs +1 -0
- package/dist/ListGroup.mjs +1 -0
- package/dist/ListItem.js +131 -117
- package/dist/ListItem.mjs +6 -5
- package/dist/MediaCard.js +54 -6
- package/dist/MediaCard.mjs +6 -5
- package/dist/MenuGroup.mjs +1 -0
- package/dist/MenuItem.js +91 -79
- package/dist/MenuItem.mjs +6 -5
- package/dist/MonthPicker.d.mts +10 -2
- package/dist/MonthPicker.d.ts +10 -2
- package/dist/MonthPicker.js +80 -17
- package/dist/MonthPicker.mjs +3 -2
- package/dist/PagerDots.d.mts +35 -0
- package/dist/PagerDots.d.ts +35 -0
- package/dist/PagerDots.js +392 -0
- package/dist/PagerDots.mjs +7 -0
- package/dist/Pressable.d.mts +5 -5
- package/dist/Pressable.d.ts +5 -5
- package/dist/Pressable.js +97 -86
- package/dist/Pressable.mjs +5 -4
- package/dist/PricingCard.d.mts +50 -0
- package/dist/PricingCard.d.ts +50 -0
- package/dist/PricingCard.js +636 -0
- package/dist/PricingCard.mjs +11 -0
- package/dist/Progress.mjs +3 -2
- package/dist/RadioGroup.js +81 -30
- package/dist/RadioGroup.mjs +5 -5
- package/dist/RetrayProvider.d.mts +2 -0
- package/dist/RetrayProvider.d.ts +2 -0
- package/dist/RetrayProvider.js +214 -0
- package/dist/RetrayProvider.mjs +5 -0
- package/dist/Select.js +51 -4
- package/dist/Select.mjs +5 -4
- package/dist/SelectableGrid.d.mts +44 -0
- package/dist/SelectableGrid.d.ts +44 -0
- package/dist/SelectableGrid.js +448 -0
- package/dist/SelectableGrid.mjs +9 -0
- package/dist/Separator.mjs +1 -0
- package/dist/Sheet.d.mts +13 -1
- package/dist/Sheet.d.ts +13 -1
- package/dist/Sheet.js +115 -5
- package/dist/Sheet.mjs +4 -2
- package/dist/Skeleton.d.mts +50 -0
- package/dist/Skeleton.d.ts +50 -0
- package/dist/Skeleton.js +61 -0
- package/dist/Skeleton.mjs +4 -2
- package/dist/Slider.js +51 -4
- package/dist/Slider.mjs +3 -2
- package/dist/Spinner.js +28 -7
- package/dist/Spinner.mjs +2 -1
- package/dist/Switch.js +98 -48
- package/dist/Switch.mjs +4 -3
- package/dist/TabBar.d.mts +42 -0
- package/dist/TabBar.d.ts +42 -0
- package/dist/TabBar.js +361 -0
- package/dist/TabBar.mjs +6 -0
- package/dist/Tabs.js +92 -62
- package/dist/Tabs.mjs +5 -4
- package/dist/Text.js +16 -0
- package/dist/Text.mjs +2 -1
- package/dist/Textarea.mjs +4 -3
- package/dist/Toast.d.mts +7 -7
- package/dist/Toast.d.ts +7 -7
- package/dist/Toast.mjs +1 -0
- package/dist/Toggle.d.mts +6 -3
- package/dist/Toggle.d.ts +6 -3
- package/dist/Toggle.js +135 -120
- package/dist/Toggle.mjs +5 -5
- package/dist/VirtualList.mjs +1 -0
- package/dist/{chunk-7H2OR44A.mjs → chunk-26BCI223.mjs} +1 -1
- package/dist/{chunk-CRYBX2CM.mjs → chunk-2TFTAWVJ.mjs} +44 -59
- package/dist/chunk-3DKJ2GIC.mjs +30 -0
- package/dist/{chunk-KWCPOM6W.mjs → chunk-3U4SSNWP.mjs} +32 -48
- package/dist/chunk-4I7D47FH.mjs +139 -0
- package/dist/chunk-4K625MVM.mjs +142 -0
- package/dist/{chunk-MN7OG7IY.mjs → chunk-6OAZJ577.mjs} +6 -4
- package/dist/{chunk-L7E7TVEZ.mjs → chunk-756RAKE4.mjs} +2 -2
- package/dist/{chunk-HSPSMN6U.mjs → chunk-7QHVVCB3.mjs} +2 -2
- package/dist/{chunk-URLL5JBR.mjs → chunk-A3A6KNQN.mjs} +3 -3
- package/dist/chunk-AJ7ZDNBT.mjs +120 -0
- package/dist/{chunk-FTLJOUOQ.mjs → chunk-AV4EMIRH.mjs} +25 -28
- package/dist/chunk-AZJF2BLK.mjs +115 -0
- package/dist/chunk-BNP626TY.mjs +159 -0
- package/dist/{chunk-5IKW3VNC.mjs → chunk-DVK4G2GT.mjs} +17 -1
- package/dist/{chunk-6LQYY7HC.mjs → chunk-EH745HE5.mjs} +2 -2
- package/dist/chunk-EJ7ZPXOH.mjs +163 -0
- package/dist/{chunk-RKLHUDZS.mjs → chunk-GD6KXMG5.mjs} +29 -15
- package/dist/{chunk-RR2VQLKE.mjs → chunk-GQYFLP3D.mjs} +14 -17
- package/dist/{chunk-Y6MXOREN.mjs → chunk-ID72TK46.mjs} +8 -17
- package/dist/{chunk-NQGVLMWG.mjs → chunk-JMOZEC77.mjs} +1 -1
- package/dist/{chunk-GCWOGZYL.mjs → chunk-JT7HKXRB.mjs} +39 -29
- package/dist/{chunk-LWG526VX.mjs → chunk-KIHCWCWL.mjs} +47 -62
- package/dist/chunk-LXJIIOYQ.mjs +104 -0
- package/dist/{chunk-SBZYEV4S.mjs → chunk-M6ZXVBTK.mjs} +5 -2
- package/dist/{chunk-XDMN67KV.mjs → chunk-MAC465BB.mjs} +10 -8
- package/dist/chunk-MBMXYJJV.mjs +36 -0
- package/dist/chunk-MLF3EZFW.mjs +119 -0
- package/dist/chunk-NA7PARID.mjs +147 -0
- package/dist/{chunk-QXGYKWI7.mjs → chunk-O3HA6TYM.mjs} +9 -4
- package/dist/{chunk-63357L2X.mjs → chunk-OB4JUQ3O.mjs} +1 -1
- package/dist/{chunk-AU2VDY4P.mjs → chunk-PFZTM6D5.mjs} +52 -4
- package/dist/chunk-QKH5ZOD5.mjs +97 -0
- package/dist/{chunk-KZJRQOIU.mjs → chunk-TERDKCLE.mjs} +11 -1
- package/dist/{chunk-U4N7WF4Z.mjs → chunk-UREA2GYY.mjs} +28 -23
- package/dist/{chunk-TAJ2PQ2O.mjs → chunk-VGTDN7SW.mjs} +7 -6
- package/dist/{chunk-URDE3EUU.mjs → chunk-VQ57HWPL.mjs} +27 -15
- package/dist/chunk-WBOOUHSS.mjs +62 -0
- package/dist/{chunk-GNGLDL6Z.mjs → chunk-WJLKJMKR.mjs} +18 -0
- package/dist/{chunk-YZJAFS4P.mjs → chunk-X4G6APW6.mjs} +22 -19
- package/dist/chunk-Y6FXYEAI.mjs +8 -0
- package/dist/chunk-YFZ3ELX5.mjs +16 -0
- package/dist/{chunk-QCNARS3X.mjs → chunk-YNROWHQJ.mjs} +1 -1
- package/dist/chunk-Z4BVUWW6.mjs +196 -0
- package/dist/{chunk-GPOUINK5.mjs → chunk-ZJKGQMYH.mjs} +10 -27
- package/dist/index-wt-orHUi.d.mts +85 -0
- package/dist/index-wt-orHUi.d.ts +85 -0
- package/dist/index.d.mts +59 -51
- package/dist/index.d.ts +59 -51
- package/dist/index.js +1940 -744
- package/dist/index.mjs +49 -39
- package/package.json +35 -5
- package/src/components/Accordion/Accordion.tsx +12 -1
- package/src/components/AlertBanner/AlertBanner.tsx +5 -0
- package/src/components/AppHeader/AppHeader.tsx +172 -0
- package/src/components/AppHeader/index.ts +1 -0
- package/src/components/Avatar/Avatar.tsx +10 -2
- package/src/components/Badge/Badge.tsx +8 -1
- package/src/components/Button/Button.tsx +20 -27
- package/src/components/Card/Card.tsx +12 -23
- package/src/components/CategoryStrip/CategoryStrip.tsx +17 -21
- package/src/components/Checkbox/Checkbox.tsx +26 -40
- package/src/components/Chip/Chip.tsx +24 -33
- package/src/components/CurrencyInput/CurrencyInput.tsx +10 -8
- package/src/components/EmptyState/EmptyState.tsx +2 -1
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +153 -0
- package/src/components/ErrorBoundary/index.ts +1 -0
- package/src/components/HolographicCard/HolographicCard.tsx +315 -0
- package/src/components/HolographicCard/index.ts +1 -0
- package/src/components/IconButton/IconButton.tsx +19 -27
- package/src/components/ImageViewer/ImageViewer.tsx +290 -0
- package/src/components/ImageViewer/index.ts +1 -0
- package/src/components/ListItem/ListItem.tsx +70 -67
- package/src/components/MediaCard/MediaCard.tsx +8 -2
- package/src/components/MenuItem/MenuItem.tsx +10 -25
- package/src/components/MonthPicker/MonthPicker.tsx +39 -13
- package/src/components/MonthPicker/index.ts +1 -1
- package/src/components/PagerDots/PagerDots.tsx +200 -0
- package/src/components/PagerDots/index.ts +1 -0
- package/src/components/Pressable/Pressable.tsx +19 -35
- package/src/components/PricingCard/PricingCard.tsx +220 -0
- package/src/components/PricingCard/index.ts +1 -0
- package/src/components/RadioGroup/RadioGroup.tsx +14 -27
- package/src/components/RetrayProvider/RetrayProvider.tsx +59 -0
- package/src/components/RetrayProvider/index.ts +1 -0
- package/src/components/SelectableGrid/SelectableGrid.tsx +205 -0
- package/src/components/SelectableGrid/index.ts +1 -0
- package/src/components/Sheet/Sheet.tsx +65 -1
- package/src/components/Skeleton/Skeleton.tsx +142 -1
- package/src/components/Spinner/Spinner.tsx +17 -2
- package/src/components/Switch/Switch.tsx +30 -58
- package/src/components/TabBar/TabBar.tsx +169 -0
- package/src/components/TabBar/index.ts +1 -0
- package/src/components/Tabs/Tabs.tsx +23 -26
- package/src/components/Text/Text.tsx +2 -0
- package/src/components/Toggle/Toggle.tsx +35 -51
- package/src/fonts.ts +4 -1
- package/src/index.ts +23 -2
- package/src/utils/animations.ts +29 -1
- package/src/utils/fontGuard.ts +34 -0
- package/src/utils/haptics.ts +211 -9
- package/src/utils/pressable.ts +66 -0
- package/dist/chunk-76PFOSM2.mjs +0 -41
- package/dist/chunk-DITNP6PL.mjs +0 -106
- package/dist/chunk-JBLL7U3U.mjs +0 -64
- package/dist/chunk-LG4DO3DK.mjs +0 -174
- package/dist/chunk-RMMK64W5.mjs +0 -54
- package/dist/chunk-RTC3CFXF.mjs +0 -29
package/COMPONENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @retray-dev/ui-kit — Component Reference (
|
|
1
|
+
# @retray-dev/ui-kit — Component Reference (v8.0.0)
|
|
2
2
|
|
|
3
3
|
This file is the AI reference for this package. It is shipped inside the npm package so consuming projects can import it into their `CLAUDE.md` with:
|
|
4
4
|
|
|
@@ -11,7 +11,27 @@ This file is the AI reference for this package. It is shipped inside the npm pac
|
|
|
11
11
|
|
|
12
12
|
## Setup (Required)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### Recommended: `RetrayProvider` (one wrapper)
|
|
15
|
+
|
|
16
|
+
Since v8, a single `RetrayProvider` wires all five required providers in the correct order — use this and skip the manual nesting:
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { RetrayProvider } from '@retray-dev/ui-kit'
|
|
20
|
+
|
|
21
|
+
export default function App() {
|
|
22
|
+
const [fontsLoaded] = useFonts(SohneFonts)
|
|
23
|
+
if (!fontsLoaded) return null
|
|
24
|
+
return (
|
|
25
|
+
<RetrayProvider colorScheme="system">
|
|
26
|
+
{/* your app */}
|
|
27
|
+
</RetrayProvider>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Manual (equivalent) — if you need a custom tree
|
|
33
|
+
|
|
34
|
+
`RetrayProvider` is exactly this; the individual providers stay exported. Order is mandatory:
|
|
15
35
|
|
|
16
36
|
```tsx
|
|
17
37
|
import { SafeAreaProvider, initialWindowMetrics } from 'react-native-safe-area-context'
|
|
@@ -42,6 +62,66 @@ export default function App() {
|
|
|
42
62
|
- `BottomSheetModalProvider` must be inside `GestureHandlerRootView`
|
|
43
63
|
- `ToastProvider` wraps children and renders `Toaster` (from `sonner-native`) internally
|
|
44
64
|
|
|
65
|
+
### Peer dependencies
|
|
66
|
+
|
|
67
|
+
Install all required peers (Expo projects: swap `pnpm add` for `npx expo install` to get SDK-pinned versions):
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pnpm add expo-font expo-haptics expo-linear-gradient react-native-safe-area-context @gorhom/bottom-sheet react-native-reanimated react-native-gesture-handler react-native-worklets @react-native-picker/picker @react-native-community/slider @expo/vector-icons react-native-size-matters react-native-svg react-native-screens sonner-native pressto
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then add the Worklets Babel plugin to `babel.config.js` (required by `@gorhom/bottom-sheet` and the pressable animations):
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
module.exports = function (api) {
|
|
77
|
+
api.cache(true)
|
|
78
|
+
return {
|
|
79
|
+
presets: ['babel-preset-expo'],
|
|
80
|
+
plugins: ['react-native-worklets/plugin'], // NOT react-native-reanimated/plugin
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
| Peer | Required? | Used by | Notes |
|
|
86
|
+
|------|-----------|---------|-------|
|
|
87
|
+
| `pressto` | **Required** | Every interactive component | Press-scale animations (`src/utils/pressable.ts`). Static import via the barrel — omitting it crashes the module load, not just one component. |
|
|
88
|
+
| `sonner-native` | **Required** | `Toast` | Also pulls `react-native-svg` + `react-native-screens`. |
|
|
89
|
+
| `react-native-reanimated` (≥4.0) | **Required** | Animations, `Sheet`, pressables | Needs the `react-native-worklets/plugin` Babel plugin. |
|
|
90
|
+
| `react-native-gesture-handler` | **Required** | `Sheet`, pressables | Wrap app in `GestureHandlerRootView`. |
|
|
91
|
+
| `@gorhom/bottom-sheet` (≥5.2.0) | **Required** | `Sheet`, `ConfirmDialog` | 5.1.x crashes on Reanimated v4. |
|
|
92
|
+
| `expo-haptics` | **Required** | Haptic feedback (all interactions) | Web-safe wrapper, no-op on web. |
|
|
93
|
+
| `expo-font` | **Required** | All `Text` | Load `SohneFonts` at app root before rendering. |
|
|
94
|
+
| `expo-linear-gradient` | **Required** | `Skeleton` shimmer | |
|
|
95
|
+
| `@react-native-picker/picker` | **Required** | `Select` | |
|
|
96
|
+
| `@react-native-community/slider` | **Required** | `Slider` | |
|
|
97
|
+
| `@expo/vector-icons` | **Required** | Icons everywhere | |
|
|
98
|
+
| `react-native-size-matters` | **Required** | Responsive scaling | |
|
|
99
|
+
| `react-native-pulsar` | **Optional** | Rich haptics on dev builds | Loaded via dynamic `import()` + try/catch; falls back to `expo-haptics`. Skip in Expo Go. `pnpm add react-native-pulsar` |
|
|
100
|
+
| `@shopify/react-native-skia` + `expo-sensors` | **Optional** | Deep-import `HolographicCard` only | `pnpm add @shopify/react-native-skia expo-sensors` |
|
|
101
|
+
|
|
102
|
+
> **Dev build vs Expo Go:** Everything in the kit runs in **Expo Go** — `react-native-pulsar` is the only native module that needs a custom dev build, and it degrades gracefully (basic haptics) when absent. No component is broken by running in Expo Go.
|
|
103
|
+
|
|
104
|
+
### Troubleshooting: `react-native-screens` codegen on RN 0.83
|
|
105
|
+
|
|
106
|
+
Toast pulls `sonner-native`, which imports `react-native-screens` via its `src/*` path. On **React Native 0.83** that source trips a `@react-native/codegen` parse error (`CT.WithDefault` not parseable). It is a `react-native-screens` issue, not the kit — but since Toast surfaces it, add this resolver to your `metro.config.js` to force the compiled `lib/commonjs` build:
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
// metro.config.js
|
|
110
|
+
const { getDefaultConfig } = require('expo/metro-config')
|
|
111
|
+
const config = getDefaultConfig(__dirname)
|
|
112
|
+
|
|
113
|
+
const defaultResolveRequest = config.resolver.resolveRequest
|
|
114
|
+
config.resolver.resolveRequest = (context, moduleName, platform) => {
|
|
115
|
+
// Force react-native-screens to its compiled output, bypassing the src codegen bug.
|
|
116
|
+
if (moduleName.startsWith('react-native-screens/src')) {
|
|
117
|
+
moduleName = moduleName.replace('react-native-screens/src', 'react-native-screens/lib/commonjs')
|
|
118
|
+
}
|
|
119
|
+
return (defaultResolveRequest ?? context.resolveRequest)(context, moduleName, platform)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
module.exports = config
|
|
123
|
+
```
|
|
124
|
+
|
|
45
125
|
## Typography — Sohne (Required)
|
|
46
126
|
|
|
47
127
|
All components use **Sohne** as the font family. You **must** load it before rendering any UI kit component.
|
|
@@ -454,6 +534,41 @@ The example app now has a dedicated **Compound Components** section showcasing `
|
|
|
454
534
|
|
|
455
535
|
---
|
|
456
536
|
|
|
537
|
+
## Migration Guide: v7 → v8
|
|
538
|
+
|
|
539
|
+
### Breaking Changes
|
|
540
|
+
|
|
541
|
+
**1. New required peer dependency: `sonner-native`**
|
|
542
|
+
Toast (`ToastProvider` / `toast` / `useToast`) imports `sonner-native`, but it was never declared as a peer — installs silently lacked it and Metro failed with `Unable to resolve "sonner-native"`. It is now a declared peer. Install it:
|
|
543
|
+
```bash
|
|
544
|
+
pnpm add sonner-native
|
|
545
|
+
```
|
|
546
|
+
(You already need its companions `react-native-svg` and `react-native-screens`.)
|
|
547
|
+
|
|
548
|
+
**2. `@gorhom/bottom-sheet` peer range tightened to `>=5.2.0`**
|
|
549
|
+
5.1.x crashes with Reanimated v4 (`useWorkletCallback is not a function`), which broke `Sheet`, `ConfirmDialog`, and `Select` on open. The range no longer admits broken versions. Pin `5.2.8` if you also use Worklets `0.5.x`.
|
|
550
|
+
|
|
551
|
+
**3. `./fonts` stays at `src/fonts.ts` (unchanged)**
|
|
552
|
+
The `./fonts` export deliberately points at `src/fonts.ts`, not `dist`. The `.otf` files ship as raw assets in `src/assets/fonts/` and are resolved by Metro at your build time via `require()`. Compiling this entry to `dist` and repointing the `require()` paths breaks Metro asset resolution under pnpm symlinked workspaces (`requiring unknown module ../src/assets/fonts/...`), so it is intentionally left as source. No API change — import as before:
|
|
553
|
+
```ts
|
|
554
|
+
import { SohneFonts } from '@retray-dev/ui-kit/fonts'
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
### New — packaging & DX
|
|
558
|
+
|
|
559
|
+
- **`RetrayProvider`** — one wrapper replacing the five-provider boilerplate (see Setup below).
|
|
560
|
+
- **Dev font guard** — if you render a UI kit component without loading `SohneFonts`, `Text` now logs a one-time `console.warn` in dev (silent in production) instead of failing invisibly.
|
|
561
|
+
|
|
562
|
+
### New components
|
|
563
|
+
|
|
564
|
+
`RetrayProvider`, `AppHeader`, `TabBar`, `PagerDots`, `SelectableGrid`, `PricingCard`, `ErrorBoundary`, `ImageViewer`, plus `Skeleton.MediaCard` / `Skeleton.ListItem` sub-skeletons and the optional deep-import-only `HolographicCard` (Skia foil card). `MonthPicker` gained `minValue`/`maxValue` and `Date` bridge helpers.
|
|
565
|
+
|
|
566
|
+
### Optional peers (only if you use the matching component)
|
|
567
|
+
|
|
568
|
+
- `@shopify/react-native-skia` + `expo-sensors` → `HolographicCard` (deep-import only, not in the main barrel).
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
457
572
|
## Components
|
|
458
573
|
|
|
459
574
|
---
|
|
@@ -1469,15 +1584,29 @@ const renderItem = useCallback(({ item }) => (
|
|
|
1469
1584
|
</View>
|
|
1470
1585
|
```
|
|
1471
1586
|
|
|
1472
|
-
**
|
|
1587
|
+
**Sub-skeletons (v8):** ready-made placeholders that mirror a component's footprint, so grids/lists don't reflow when real data arrives.
|
|
1588
|
+
|
|
1473
1589
|
```tsx
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1590
|
+
// Matches <MediaCard> — image block + title/subtitle lines
|
|
1591
|
+
<Skeleton.MediaCard aspectRatio="4:3" /> // props: aspectRatio ('1:1'|'4:3'|'16:9'|'4:5'|'3:2'), showSubtitle, style
|
|
1592
|
+
|
|
1593
|
+
// Matches <ListItem> — leading circle + title/subtitle lines
|
|
1594
|
+
<Skeleton.ListItem /> // props: showAvatar, showSubtitle, style
|
|
1595
|
+
|
|
1596
|
+
// Repeated list/grid placeholder — for VirtualList / FlatList while loading.
|
|
1597
|
+
// columns=1 → stacked ListItemSkeleton; columns>1 → grid of MediaCardSkeleton.
|
|
1598
|
+
<Skeleton.List count={6} /> // stacked list
|
|
1599
|
+
<Skeleton.List count={6} columns={2} /> // 2-col card grid
|
|
1600
|
+
// props: count, columns, gap, aspectRatio (grid), showAvatar (list), style
|
|
1601
|
+
|
|
1602
|
+
// Also exported as named components: MediaCardSkeleton, ListItemSkeleton, ListSkeleton
|
|
1603
|
+
|
|
1604
|
+
// As a VirtualList loading state
|
|
1605
|
+
<VirtualList
|
|
1606
|
+
data={loading ? [] : rows}
|
|
1607
|
+
renderItem={renderItem}
|
|
1608
|
+
ListEmptyComponent={loading ? <Skeleton.List count={8} /> : <EmptyState .../>}
|
|
1609
|
+
/>
|
|
1481
1610
|
```
|
|
1482
1611
|
|
|
1483
1612
|
---
|
|
@@ -2095,10 +2224,13 @@ Add `react-native-worklets/plugin` (not `react-native-reanimated/plugin`) to `ba
|
|
|
2095
2224
|
| android_keyboardInputMode | `'adjustPan' \| 'adjustResize'` | `'adjustPan'` | Android-only: `'adjustPan'` moves the window (default — fixes restore issues with dynamic sizing). `'adjustResize'` resizes the container (can cause transparent gap when keyboard dismisses) |
|
|
2096
2225
|
| footer | `ReactNode` | — | Sticky footer below scroll area (sticky above keyboard) |
|
|
2097
2226
|
| snapPoints | `(string \| number)[]` | — | Optional snap points (e.g., `['50%', '85%']`). When omitted, uses dynamic sizing (auto-fits content) |
|
|
2227
|
+
| responsive | `boolean` | `false` | **(v8)** On wide screens (width ≥ `BREAKPOINTS.wide`) render a centered modal dialog instead of a bottom sheet. Stays a bottom sheet on phones |
|
|
2228
|
+
| dialogMaxWidth | `number` | `480` | Max width of the centered dialog. Only applies when `responsive` |
|
|
2098
2229
|
|
|
2099
2230
|
**Features:**
|
|
2100
2231
|
- `enableDynamicSizing` — height auto-fits content, no `snapPoints` needed (default behavior when `snapPoints` is omitted)
|
|
2101
2232
|
- `snapPoints` — optionally provide custom snap points (e.g., `['50%', '85%']`). Disables dynamic sizing when provided
|
|
2233
|
+
- `responsive` — on tablets/web, becomes a centered dialog (max width `dialogMaxWidth`). Note: the dialog path uses a plain RN `Modal`, so `SheetTextInput` is **not** required there — use a regular `TextInput`
|
|
2102
2234
|
- `enablePanDownToClose` — swipe down to dismiss
|
|
2103
2235
|
- Backdrop press dismisses
|
|
2104
2236
|
- **Scrollable content:** use `scrollable` prop or `maxHeight`. Both use `BottomSheetScrollView` — do NOT use plain `ScrollView` inside Sheet
|
|
@@ -3078,6 +3210,8 @@ Total ·············· $50.000
|
|
|
3078
3210
|
|------|------|---------|-------|
|
|
3079
3211
|
| value | `MonthPickerValue` | required | `{ month: 1–12, year: number }` |
|
|
3080
3212
|
| onChange | `(value: MonthPickerValue) => void` | required | Called on navigation |
|
|
3213
|
+
| minValue | `MonthPickerValue` | — | Earliest selectable month (inclusive). Prev arrow disables + dims at this bound |
|
|
3214
|
+
| maxValue | `MonthPickerValue` | — | Latest selectable month (inclusive). Next arrow disables + dims at this bound — e.g. cap at the current month |
|
|
3081
3215
|
| locale | `string` | `'en'` | BCP 47 locale. Built-in: `'en'`, `'es'`, `'pt'`, `'fr'`. Other locales: use `formatLabel` |
|
|
3082
3216
|
| formatLabel | `(value: MonthPickerValue) => string` | — | Custom label formatter. Takes precedence over `locale` |
|
|
3083
3217
|
| style | `ViewStyle` | — | — |
|
|
@@ -3087,7 +3221,15 @@ Total ·············· $50.000
|
|
|
3087
3221
|
{ month: number; year: number } // month is 1-indexed (January = 1)
|
|
3088
3222
|
```
|
|
3089
3223
|
|
|
3090
|
-
**
|
|
3224
|
+
**Date bridge helpers** (exported): for domains that store `Date` (e.g. finance apps in a fixed TZ), convert at the boundary instead of changing your model.
|
|
3225
|
+
```ts
|
|
3226
|
+
import { dateToMonthPickerValue, monthPickerValueToDate } from '@retray-dev/ui-kit'
|
|
3227
|
+
|
|
3228
|
+
dateToMonthPickerValue(new Date()) // → { month, year } (local time)
|
|
3229
|
+
monthPickerValueToDate({ month: 6, year: 2026 }) // → Date at first day of the month
|
|
3230
|
+
```
|
|
3231
|
+
|
|
3232
|
+
**Navigation:** Year wraps correctly at boundaries (December → January increments year, January → December decrements year). When `minValue`/`maxValue` are set, the boundary arrow is disabled (opacity 0.3) and presses are ignored. Fully controlled — no internal state.
|
|
3091
3233
|
|
|
3092
3234
|
**Styling:** Centered row with `←` / `→` buttons (44×44px each). Label: 17pt / Medium / 160px min-width, centered.
|
|
3093
3235
|
|
|
@@ -3186,6 +3328,407 @@ const [period, setPeriod] = useState({
|
|
|
3186
3328
|
|
|
3187
3329
|
---
|
|
3188
3330
|
|
|
3331
|
+
### RetrayProvider
|
|
3332
|
+
|
|
3333
|
+
**Import:** `import { RetrayProvider } from '@retray-dev/ui-kit'`
|
|
3334
|
+
|
|
3335
|
+
**When to use:** At your app root, instead of hand-nesting the five required providers. Removes an entire class of provider-order bugs. The individual providers stay exported for custom trees.
|
|
3336
|
+
|
|
3337
|
+
| Prop | Type | Default | Notes |
|
|
3338
|
+
|------|------|---------|-------|
|
|
3339
|
+
| children | `ReactNode` | required | Your app |
|
|
3340
|
+
| theme | `Theme` | — | Per-scheme token overrides, forwarded to `ThemeProvider` |
|
|
3341
|
+
| colorScheme | `'system' \| 'light' \| 'dark'` | `'system'` | Forwarded to `ThemeProvider` |
|
|
3342
|
+
|
|
3343
|
+
**Wraps (in order):** `SafeAreaProvider` (with `initialWindowMetrics`) → `GestureHandlerRootView` → `ThemeProvider` → `BottomSheetModalProvider` → `ToastProvider`.
|
|
3344
|
+
|
|
3345
|
+
**Example:**
|
|
3346
|
+
```tsx
|
|
3347
|
+
import { RetrayProvider } from '@retray-dev/ui-kit'
|
|
3348
|
+
|
|
3349
|
+
export default function App() {
|
|
3350
|
+
const [fontsLoaded] = useFonts(SohneFonts)
|
|
3351
|
+
if (!fontsLoaded) return null
|
|
3352
|
+
return (
|
|
3353
|
+
<RetrayProvider colorScheme="system" theme={{ light: { primary: '#ff385c' } }}>
|
|
3354
|
+
<RootNavigator />
|
|
3355
|
+
</RetrayProvider>
|
|
3356
|
+
)
|
|
3357
|
+
}
|
|
3358
|
+
```
|
|
3359
|
+
|
|
3360
|
+
---
|
|
3361
|
+
|
|
3362
|
+
### AppHeader
|
|
3363
|
+
|
|
3364
|
+
**Import:** `import { AppHeader } from '@retray-dev/ui-kit'`
|
|
3365
|
+
|
|
3366
|
+
**When to use:** Top app bar / screen chrome — back button, title/subtitle, and a right action slot. Responsive: title left-aligns on phones and centers when width ≥ `BREAKPOINTS.wide`.
|
|
3367
|
+
|
|
3368
|
+
**Expo Router compatibility:** ✅ Fully compatible. Use with `useRouter()` for navigation:
|
|
3369
|
+
|
|
3370
|
+
```tsx
|
|
3371
|
+
import { useRouter } from 'expo-router'
|
|
3372
|
+
import { AppHeader } from '@retray-dev/ui-kit'
|
|
3373
|
+
|
|
3374
|
+
export default function Screen() {
|
|
3375
|
+
const router = useRouter()
|
|
3376
|
+
return (
|
|
3377
|
+
<AppHeader
|
|
3378
|
+
title="Settings"
|
|
3379
|
+
onBack={() => router.back()}
|
|
3380
|
+
right={<IconButton iconName="more-horizontal" variant="text" />}
|
|
3381
|
+
/>
|
|
3382
|
+
)
|
|
3383
|
+
}
|
|
3384
|
+
```
|
|
3385
|
+
|
|
3386
|
+
| Prop | Type | Default | Notes |
|
|
3387
|
+
|------|------|---------|-------|
|
|
3388
|
+
| title | `string` | — | Primary title (truncates to 1 line) |
|
|
3389
|
+
| subtitle | `string` | — | Secondary line under the title |
|
|
3390
|
+
| onBack | `() => void` | — | Shows a back button on the left when provided |
|
|
3391
|
+
| backIconName | `string` | `'chevron-left'` | Icon for the back button |
|
|
3392
|
+
| left | `ReactNode` | — | Custom left content — overrides the back button |
|
|
3393
|
+
| right | `ReactNode` | — | Custom right content (actions) |
|
|
3394
|
+
| titleAlign | `'auto' \| 'left' \| 'center'` | `'auto'` | `auto` = left on narrow, centered on wide |
|
|
3395
|
+
| bordered | `boolean` | `true` | Hairline border underneath |
|
|
3396
|
+
| withSafeArea | `boolean` | `true` | Apply top safe-area inset as padding |
|
|
3397
|
+
| backgroundColor | `string` | `colors.background` | — |
|
|
3398
|
+
| style | `ViewStyle` | — | — |
|
|
3399
|
+
|
|
3400
|
+
**Example:**
|
|
3401
|
+
```tsx
|
|
3402
|
+
<AppHeader
|
|
3403
|
+
title="Settings"
|
|
3404
|
+
onBack={navigation.goBack}
|
|
3405
|
+
right={<IconButton iconName="more-horizontal" variant="text" onPress={openMenu} />}
|
|
3406
|
+
/>
|
|
3407
|
+
```
|
|
3408
|
+
|
|
3409
|
+
---
|
|
3410
|
+
|
|
3411
|
+
### TabBar
|
|
3412
|
+
|
|
3413
|
+
**Import:** `import { TabBar } from '@retray-dev/ui-kit'`
|
|
3414
|
+
|
|
3415
|
+
**When to use:** Bottom tab navigation — icon + label tabs with active tint and badges. Pair with your navigator, or drive with local state for a single-screen app.
|
|
3416
|
+
|
|
3417
|
+
**Expo Router compatibility:** ✅ Fully compatible. Use in `_layout.tsx` to build custom tab navigation:
|
|
3418
|
+
|
|
3419
|
+
```tsx
|
|
3420
|
+
// app/(tabs)/_layout.tsx
|
|
3421
|
+
import { Tabs, useRouter, useSegments } from 'expo-router'
|
|
3422
|
+
import { TabBar } from '@retray-dev/ui-kit'
|
|
3423
|
+
|
|
3424
|
+
export default function TabLayout() {
|
|
3425
|
+
const router = useRouter()
|
|
3426
|
+
const segments = useSegments()
|
|
3427
|
+
const activeKey = segments[1] || 'home'
|
|
3428
|
+
|
|
3429
|
+
return (
|
|
3430
|
+
<Tabs
|
|
3431
|
+
tabBar={() => (
|
|
3432
|
+
<TabBar
|
|
3433
|
+
items={[
|
|
3434
|
+
{ key: 'home', label: 'Home', iconName: 'home' },
|
|
3435
|
+
{ key: 'search', label: 'Search', iconName: 'search' },
|
|
3436
|
+
{ key: 'profile', label: 'Profile', iconName: 'user', badge: 3 },
|
|
3437
|
+
]}
|
|
3438
|
+
activeKey={activeKey}
|
|
3439
|
+
onTabPress={(key) => router.push(`/(tabs)/${key}`)}
|
|
3440
|
+
/>
|
|
3441
|
+
)}
|
|
3442
|
+
>
|
|
3443
|
+
{/* ... screens */}
|
|
3444
|
+
</Tabs>
|
|
3445
|
+
)
|
|
3446
|
+
}
|
|
3447
|
+
```
|
|
3448
|
+
|
|
3449
|
+
| Prop | Type | Default | Notes |
|
|
3450
|
+
|------|------|---------|-------|
|
|
3451
|
+
| items | `TabBarItem[]` | required | `{ key, label?, iconName?, icon?, badge? }` |
|
|
3452
|
+
| activeKey | `string` | required | Key of the active tab |
|
|
3453
|
+
| onTabPress | `(key: string) => void` | required | — |
|
|
3454
|
+
| activeColor | `string` | `colors.primary` | — |
|
|
3455
|
+
| inactiveColor | `string` | `colors.foregroundMuted` | — |
|
|
3456
|
+
| withSafeArea | `boolean` | `true` | Apply bottom safe-area inset |
|
|
3457
|
+
| style | `ViewStyle` | — | — |
|
|
3458
|
+
|
|
3459
|
+
**TabBarItem.badge:** `true` shows a dot; a number shows a count (capped at `99+`).
|
|
3460
|
+
|
|
3461
|
+
**Haptics:** `selectionAsync` when switching to a new tab.
|
|
3462
|
+
|
|
3463
|
+
**Example:**
|
|
3464
|
+
```tsx
|
|
3465
|
+
<TabBar
|
|
3466
|
+
activeKey={tab}
|
|
3467
|
+
onTabPress={setTab}
|
|
3468
|
+
items={[
|
|
3469
|
+
{ key: 'home', label: 'Home', iconName: 'home' },
|
|
3470
|
+
{ key: 'wallet', label: 'Wallet', iconName: 'credit-card' },
|
|
3471
|
+
{ key: 'profile', label: 'Profile', iconName: 'user', badge: 3 },
|
|
3472
|
+
]}
|
|
3473
|
+
/>
|
|
3474
|
+
```
|
|
3475
|
+
|
|
3476
|
+
---
|
|
3477
|
+
|
|
3478
|
+
### PagerDots
|
|
3479
|
+
|
|
3480
|
+
**Import:** `import { PagerDots } from '@retray-dev/ui-kit'`
|
|
3481
|
+
|
|
3482
|
+
**When to use:** Page indicator for carousels / document pagers. The active dot stretches into a pill and color-crossfades — all on the UI thread. Now supports optional previous/next control buttons.
|
|
3483
|
+
|
|
3484
|
+
| Prop | Type | Default | Notes |
|
|
3485
|
+
|------|------|---------|-------|
|
|
3486
|
+
| count | `number` | required | Total pages |
|
|
3487
|
+
| activeIndex | `number` | required | 0-based active page |
|
|
3488
|
+
| onDotPress | `(index: number) => void` | — | Omit to make dots non-interactive |
|
|
3489
|
+
| showControls | `boolean \| { onPrevious?, onNext? }` | `false` | Show prev/next buttons. If `true`, uses `onDotPress(activeIndex ± 1)`. If object, uses custom handlers |
|
|
3490
|
+
| dotSize | `number` | `8` | Inactive dot diameter (dp) |
|
|
3491
|
+
| spacing | `number` | `8` | Gap between dots (dp) |
|
|
3492
|
+
| activeColor | `string` | `colors.primary` | — |
|
|
3493
|
+
| inactiveColor | `string` | `colors.border` | — |
|
|
3494
|
+
| style | `ViewStyle` | — | — |
|
|
3495
|
+
|
|
3496
|
+
**Example:**
|
|
3497
|
+
```tsx
|
|
3498
|
+
<PagerDots count={pages.length} activeIndex={page} onDotPress={setPage} showControls />
|
|
3499
|
+
```
|
|
3500
|
+
|
|
3501
|
+
---
|
|
3502
|
+
|
|
3503
|
+
### SelectableGrid
|
|
3504
|
+
|
|
3505
|
+
**Import:** `import { SelectableGrid } from '@retray-dev/ui-kit'`
|
|
3506
|
+
|
|
3507
|
+
**When to use:** Grid of selectable cells (icon + label) — store / category / emoji pickers where a list would be the wrong shape. Single or multi select. Generic over the value type (`string | number`). Now supports horizontal scrolling mode for single-row layouts.
|
|
3508
|
+
|
|
3509
|
+
| Prop | Type | Default | Notes |
|
|
3510
|
+
|------|------|---------|-------|
|
|
3511
|
+
| items | `SelectableGridItem<T>[]` | required | `{ value, label?, iconName?, icon?, disabled? }` |
|
|
3512
|
+
| value | `T \| T[] \| null` | required | Selected value(s) — array when `multiple` |
|
|
3513
|
+
| onChange | `(value: T) => void` | required | Fires with the toggled item's value |
|
|
3514
|
+
| multiple | `boolean` | `false` | Allow multiple selection (`value` should be an array) |
|
|
3515
|
+
| numColumns | `number` | `4` | Cells per row (exact-fit width is measured, not percentage). Ignored when `orientation='horizontal'` |
|
|
3516
|
+
| gap | `number` | `12` | Gap between cells (dp) |
|
|
3517
|
+
| orientation | `'grid' \| 'horizontal'` | `'grid'` | `'grid'` wraps into rows, `'horizontal'` creates a single scrollable row |
|
|
3518
|
+
| style | `ViewStyle` | — | — |
|
|
3519
|
+
|
|
3520
|
+
**Selected cell:** primary border + tinted background; icon/label switch to `primary`. **Press scale:** chip (0.94). **Haptics:** `selectionAsync` on press.
|
|
3521
|
+
|
|
3522
|
+
**Horizontal mode:** Fixed 96dp cell width, horizontal ScrollView, no vertical wrapping.
|
|
3523
|
+
|
|
3524
|
+
**Example:**
|
|
3525
|
+
```tsx
|
|
3526
|
+
{/* Grid layout */}
|
|
3527
|
+
<SelectableGrid
|
|
3528
|
+
items={categories}
|
|
3529
|
+
value={category}
|
|
3530
|
+
onChange={setCategory}
|
|
3531
|
+
numColumns={4}
|
|
3532
|
+
/>
|
|
3533
|
+
|
|
3534
|
+
{/* Horizontal scrolling */}
|
|
3535
|
+
<SelectableGrid
|
|
3536
|
+
items={categories}
|
|
3537
|
+
value={category}
|
|
3538
|
+
onChange={setCategory}
|
|
3539
|
+
orientation="horizontal"
|
|
3540
|
+
/>
|
|
3541
|
+
```
|
|
3542
|
+
|
|
3543
|
+
**Example:**
|
|
3544
|
+
```tsx
|
|
3545
|
+
<SelectableGrid
|
|
3546
|
+
items={[
|
|
3547
|
+
{ value: 'food', label: 'Food', iconName: 'coffee' },
|
|
3548
|
+
{ value: 'transport', label: 'Transport', iconName: 'truck' },
|
|
3549
|
+
{ value: 'home', label: 'Home', iconName: 'home' },
|
|
3550
|
+
]}
|
|
3551
|
+
value={category}
|
|
3552
|
+
onChange={setCategory}
|
|
3553
|
+
numColumns={4}
|
|
3554
|
+
/>
|
|
3555
|
+
```
|
|
3556
|
+
|
|
3557
|
+
---
|
|
3558
|
+
|
|
3559
|
+
### PricingCard
|
|
3560
|
+
|
|
3561
|
+
**Import:** `import { PricingCard } from '@retray-dev/ui-kit'`
|
|
3562
|
+
|
|
3563
|
+
**When to use:** Paywalls and freemium tiers — price header, feature list with check marks, optional promo badge, and CTA. Set `highlighted` on the recommended plan.
|
|
3564
|
+
|
|
3565
|
+
| Prop | Type | Default | Notes |
|
|
3566
|
+
|------|------|---------|-------|
|
|
3567
|
+
| name | `string` | required | Plan name |
|
|
3568
|
+
| price | `string` | required | Formatted price, e.g. `"$9"` or `"Free"` |
|
|
3569
|
+
| period | `string` | — | Billing suffix, e.g. `"/mo"` |
|
|
3570
|
+
| description | `string` | — | Short text under the price |
|
|
3571
|
+
| features | `(string \| PricingFeature)[]` | `[]` | Strings = included; `{ label, included: false }` for excluded (dashed, struck) |
|
|
3572
|
+
| ctaLabel | `string` | — | CTA button label (renders a `Button`) |
|
|
3573
|
+
| onCtaPress | `() => void` | — | — |
|
|
3574
|
+
| badge | `string` | — | Promo badge, e.g. `"Most popular"` |
|
|
3575
|
+
| highlighted | `boolean` | `false` | Primary border + elevation + primary CTA |
|
|
3576
|
+
| footnote | `string` | — | Small print under the CTA |
|
|
3577
|
+
| style | `ViewStyle` | — | — |
|
|
3578
|
+
|
|
3579
|
+
**Example:**
|
|
3580
|
+
```tsx
|
|
3581
|
+
<PricingCard
|
|
3582
|
+
name="Pro"
|
|
3583
|
+
price="$9"
|
|
3584
|
+
period="/mo"
|
|
3585
|
+
badge="Most popular"
|
|
3586
|
+
highlighted
|
|
3587
|
+
features={['Unlimited docs', 'Priority support', { label: 'SSO', included: false }]}
|
|
3588
|
+
ctaLabel="Start trial"
|
|
3589
|
+
onCtaPress={subscribe}
|
|
3590
|
+
footnote="Cancel anytime"
|
|
3591
|
+
/>
|
|
3592
|
+
```
|
|
3593
|
+
|
|
3594
|
+
---
|
|
3595
|
+
|
|
3596
|
+
### ErrorBoundary
|
|
3597
|
+
|
|
3598
|
+
**Import:** `import { ErrorBoundary } from '@retray-dev/ui-kit'`
|
|
3599
|
+
|
|
3600
|
+
**When to use:** Wrap screens or risky subtrees so a render error shows a themed fallback instead of unmounting the whole app.
|
|
3601
|
+
|
|
3602
|
+
| Prop | Type | Default | Notes |
|
|
3603
|
+
|------|------|---------|-------|
|
|
3604
|
+
| children | `ReactNode` | required | Protected subtree |
|
|
3605
|
+
| fallback | `ReactNode \| (props: { error, reset }) => ReactNode` | themed card | Custom fallback |
|
|
3606
|
+
| title | `string` | `'Something went wrong'` | Default fallback title |
|
|
3607
|
+
| message | `string` | `error.message` | Default fallback body |
|
|
3608
|
+
| onError | `(error, info) => void` | — | Wire your crash reporter here |
|
|
3609
|
+
|
|
3610
|
+
**Default fallback:** centered themed card with a destructive icon, title, message, and a "Try again" button that calls `reset()`.
|
|
3611
|
+
|
|
3612
|
+
**Example:**
|
|
3613
|
+
```tsx
|
|
3614
|
+
<ErrorBoundary onError={reportCrash}>
|
|
3615
|
+
<DocumentViewer />
|
|
3616
|
+
</ErrorBoundary>
|
|
3617
|
+
|
|
3618
|
+
// Custom fallback
|
|
3619
|
+
<ErrorBoundary fallback={({ error, reset }) => <MyFallback error={error} onRetry={reset} />}>
|
|
3620
|
+
<RiskyScreen />
|
|
3621
|
+
</ErrorBoundary>
|
|
3622
|
+
```
|
|
3623
|
+
|
|
3624
|
+
---
|
|
3625
|
+
|
|
3626
|
+
### ImageViewer
|
|
3627
|
+
|
|
3628
|
+
**Import:** `import { ImageViewer } from '@retray-dev/ui-kit'`
|
|
3629
|
+
|
|
3630
|
+
**When to use:** Full-screen zoomable image gallery — multi-page documents, photo viewers. Horizontal paging + pinch / double-tap zoom + pan, with page dots and a close button. Requires `react-native-gesture-handler` (already a peer).
|
|
3631
|
+
|
|
3632
|
+
| Prop | Type | Default | Notes |
|
|
3633
|
+
|------|------|---------|-------|
|
|
3634
|
+
| images | `ImageSourcePropType[]` | required | `{ uri }` or `require()` sources |
|
|
3635
|
+
| visible | `boolean` | required | Controls the modal |
|
|
3636
|
+
| onClose | `() => void` | required | — |
|
|
3637
|
+
| initialIndex | `number` | `0` | Page to open on |
|
|
3638
|
+
|
|
3639
|
+
**Behavior:** pinch to zoom (max 3×), double-tap to toggle 2.5× zoom, pan while zoomed. Paging locks automatically while a page is zoomed in. `PagerDots` shown when there is more than one image.
|
|
3640
|
+
|
|
3641
|
+
**Example:**
|
|
3642
|
+
```tsx
|
|
3643
|
+
<ImageViewer
|
|
3644
|
+
images={doc.pages.map((uri) => ({ uri }))}
|
|
3645
|
+
visible={viewerOpen}
|
|
3646
|
+
initialIndex={page}
|
|
3647
|
+
onClose={() => setViewerOpen(false)}
|
|
3648
|
+
/>
|
|
3649
|
+
```
|
|
3650
|
+
|
|
3651
|
+
---
|
|
3652
|
+
|
|
3653
|
+
### HolographicCard
|
|
3654
|
+
|
|
3655
|
+
**Import (deep import only):** `import { HolographicCard, FOIL_PRESETS, FoilPreset } from '@retray-dev/ui-kit/HolographicCard'`
|
|
3656
|
+
|
|
3657
|
+
> Not re-exported from the main barrel — it depends on the **optional** peers `@shopify/react-native-skia` and `expo-sensors`, which are deliberately kept out of the main module graph. Deep-import it so consumers who don't use it never pull Skia.
|
|
3658
|
+
|
|
3659
|
+
**When to use:** Holographic / foil trading-card surface (Pokémon-TCG style). Renders art on a Skia canvas with an animated rainbow sheen and tilts in 3D toward device motion; the sheen tracks the tilt so the foil "catches the light".
|
|
3660
|
+
|
|
3661
|
+
**Install:** `pnpm add @shopify/react-native-skia expo-sensors`
|
|
3662
|
+
|
|
3663
|
+
| Prop | Type | Default | Notes |
|
|
3664
|
+
|------|------|---------|-------|
|
|
3665
|
+
| source | `require()` / `{ uri }` | — | Card art. Omitted = gradient-only foil surface |
|
|
3666
|
+
| width | `number` | `300` | Card width (dp) |
|
|
3667
|
+
| height | `number` | `width * 1.4` | Trading-card ratio by default |
|
|
3668
|
+
| borderRadius | `number` | `RADIUS.md` | — |
|
|
3669
|
+
| enableTilt | `boolean` | `true` | React to gyroscope. No-op on web; static sheen if `expo-sensors` is absent |
|
|
3670
|
+
| intensity | `number` | `1` | Foil sheen strength, 0–1 |
|
|
3671
|
+
| onPress | `() => void` | — | Adds card press-scale + `impactLight` |
|
|
3672
|
+
| style | `ViewStyle` | — | — |
|
|
3673
|
+
| foilPreset | `FoilPreset` | `'rainbow'` | Foil color preset. Ignored if `foilColors` is provided |
|
|
3674
|
+
| foilColors | `string[]` | — | Custom foil gradient colors (array of RGBA strings). Overrides `foilPreset` |
|
|
3675
|
+
| maxTiltDegrees | `number` | `10` | Maximum tilt angle in degrees (0–45) |
|
|
3676
|
+
| tiltSensitivity | `number` | `1` | Sensitivity of tilt to device motion (0.1–2). Higher = more responsive |
|
|
3677
|
+
| sheenSpread | `number` | `0.6` | How far the sheen moves relative to tilt (0–1) |
|
|
3678
|
+
| tiltAnimationDuration | `number` | `80` | Animation duration for tilt smoothing in ms |
|
|
3679
|
+
| perspective | `number` | `800` | Perspective depth for 3D effect (200–2000) |
|
|
3680
|
+
| blendMode | `string` | `'plus'` | Blend mode: `'plus'` \| `'screen'` \| `'overlay'` \| `'softLight'` \| `'hardLight'` |
|
|
3681
|
+
|
|
3682
|
+
**Available foil presets (`FoilPreset`):**
|
|
3683
|
+
|
|
3684
|
+
| Preset | Description |
|
|
3685
|
+
|--------|-------------|
|
|
3686
|
+
| `rainbow` | Classic holographic rainbow (default) |
|
|
3687
|
+
| `gold` | Premium gold foil |
|
|
3688
|
+
| `silver` | Chrome silver foil |
|
|
3689
|
+
| `cosmic` | Deep space cosmic |
|
|
3690
|
+
| `emerald` | Emerald green luxury |
|
|
3691
|
+
| `rose` | Rose gold / pink |
|
|
3692
|
+
| `ocean` | Deep ocean blue |
|
|
3693
|
+
| `fire` | Hot fire gradient |
|
|
3694
|
+
| `aurora` | Aurora borealis |
|
|
3695
|
+
| `neon` | Neon cyberpunk |
|
|
3696
|
+
|
|
3697
|
+
**Example:**
|
|
3698
|
+
```tsx
|
|
3699
|
+
import { HolographicCard, FOIL_PRESETS } from '@retray-dev/ui-kit/HolographicCard'
|
|
3700
|
+
|
|
3701
|
+
// Basic usage
|
|
3702
|
+
<HolographicCard source={require('./assets/card.png')} width={320} onPress={openCard} />
|
|
3703
|
+
|
|
3704
|
+
// Gold foil preset with higher tilt
|
|
3705
|
+
<HolographicCard
|
|
3706
|
+
source={{ uri: 'https://example.com/card.png' }}
|
|
3707
|
+
width={280}
|
|
3708
|
+
foilPreset="gold"
|
|
3709
|
+
maxTiltDegrees={25}
|
|
3710
|
+
tiltSensitivity={1.5}
|
|
3711
|
+
intensity={0.9}
|
|
3712
|
+
/>
|
|
3713
|
+
|
|
3714
|
+
// Custom foil colors
|
|
3715
|
+
<HolographicCard
|
|
3716
|
+
width={280}
|
|
3717
|
+
foilColors={[
|
|
3718
|
+
'rgba(255, 0, 0, 0.5)',
|
|
3719
|
+
'rgba(255, 255, 0, 0.4)',
|
|
3720
|
+
'rgba(0, 255, 0, 0.5)',
|
|
3721
|
+
]}
|
|
3722
|
+
blendMode="screen"
|
|
3723
|
+
perspective={1200}
|
|
3724
|
+
/>
|
|
3725
|
+
|
|
3726
|
+
// Foil-only surface (no image)
|
|
3727
|
+
<HolographicCard foilPreset="cosmic" width={200} maxTiltDegrees={30} />
|
|
3728
|
+
```
|
|
3729
|
+
|
|
3730
|
+
---
|
|
3731
|
+
|
|
3189
3732
|
## Icon System
|
|
3190
3733
|
|
|
3191
3734
|
The library ships a built-in icon resolver — pass any icon name string to components without manual imports.
|
package/EXAMPLES.md
CHANGED
|
@@ -892,7 +892,7 @@ These examples are live in the `example/` app included with the source. To run t
|
|
|
892
892
|
|
|
893
893
|
```bash
|
|
894
894
|
# Clone the repo
|
|
895
|
-
git clone https://github.com/
|
|
895
|
+
git clone https://github.com/retray-dev/retray-ui-kit
|
|
896
896
|
cd retray-ui-kit
|
|
897
897
|
|
|
898
898
|
# Install dependencies
|
|
@@ -907,7 +907,7 @@ pnpm start
|
|
|
907
907
|
# Or: pnpm ios / pnpm android
|
|
908
908
|
```
|
|
909
909
|
|
|
910
|
-
Inside the example app,
|
|
910
|
+
Inside the example app, open the **Compose** tab in the bottom tab bar to browse the composed screen patterns alongside the per-category component showcases (Display, Form, Surfaces, Data, Demos, Theme).
|
|
911
911
|
|
|
912
912
|
---
|
|
913
913
|
|