@boostdev/design-system-react-native 0.1.0 → 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.
- package/CHANGELOG.md +42 -0
- package/LICENSE +15 -0
- package/README.md +104 -2
- package/dist/index.cjs +100 -57
- package/dist/index.d.cts +61 -6
- package/dist/index.d.ts +61 -6
- package/dist/index.js +100 -57
- package/package.json +30 -10
- package/src/components/interaction/Button/Button.mdx +91 -0
- package/src/components/interaction/Button/Button.spec.tsx +55 -0
- package/src/components/interaction/Button/Button.stories.tsx +141 -0
- package/src/components/interaction/Button/Button.tsx +105 -0
- package/src/components/interaction/Dialog/Dialog.mdx +61 -0
- package/src/components/interaction/Dialog/Dialog.spec.tsx +73 -0
- package/src/components/interaction/Dialog/Dialog.stories.tsx +53 -0
- package/src/components/interaction/Dialog/Dialog.tsx +128 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.mdx +74 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.spec.tsx +78 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.stories.tsx +51 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.tsx +254 -0
- package/src/components/interaction/Popover/Popover.mdx +61 -0
- package/src/components/interaction/Popover/Popover.spec.tsx +73 -0
- package/src/components/interaction/Popover/Popover.stories.tsx +44 -0
- package/src/components/interaction/Popover/Popover.tsx +87 -0
- package/src/components/interaction/Rating/Rating.mdx +55 -0
- package/src/components/interaction/Rating/Rating.spec.tsx +38 -0
- package/src/components/interaction/Rating/Rating.stories.tsx +37 -0
- package/src/components/interaction/Rating/Rating.tsx +50 -0
- package/src/components/interaction/SideSheet/SideSheet.mdx +60 -0
- package/src/components/interaction/SideSheet/SideSheet.spec.tsx +80 -0
- package/src/components/interaction/SideSheet/SideSheet.stories.tsx +33 -0
- package/src/components/interaction/SideSheet/SideSheet.tsx +175 -0
- package/src/components/interaction/Toast/Toast.mdx +81 -0
- package/src/components/interaction/Toast/Toast.spec.tsx +80 -0
- package/src/components/interaction/Toast/Toast.stories.tsx +47 -0
- package/src/components/interaction/Toast/Toast.tsx +202 -0
- package/src/components/interaction/form/Checkbox/Checkbox.mdx +74 -0
- package/src/components/interaction/form/Checkbox/Checkbox.spec.tsx +42 -0
- package/src/components/interaction/form/Checkbox/Checkbox.stories.tsx +34 -0
- package/src/components/interaction/form/Checkbox/Checkbox.tsx +80 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.mdx +78 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.spec.tsx +57 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.stories.tsx +96 -0
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.tsx +61 -0
- package/src/components/interaction/form/Combobox/Combobox.mdx +86 -0
- package/src/components/interaction/form/Combobox/Combobox.spec.tsx +60 -0
- package/src/components/interaction/form/Combobox/Combobox.stories.tsx +99 -0
- package/src/components/interaction/form/Combobox/Combobox.tsx +211 -0
- package/src/components/interaction/form/FileInput/FileInput.mdx +86 -0
- package/src/components/interaction/form/FileInput/FileInput.spec.tsx +73 -0
- package/src/components/interaction/form/FileInput/FileInput.stories.tsx +69 -0
- package/src/components/interaction/form/FileInput/FileInput.tsx +129 -0
- package/src/components/interaction/form/FormInput/FormInput.mdx +81 -0
- package/src/components/interaction/form/FormInput/FormInput.spec.tsx +51 -0
- package/src/components/interaction/form/FormInput/FormInput.stories.tsx +54 -0
- package/src/components/interaction/form/FormInput/FormInput.tsx +122 -0
- package/src/components/interaction/form/NumberInput/NumberInput.mdx +87 -0
- package/src/components/interaction/form/NumberInput/NumberInput.spec.tsx +63 -0
- package/src/components/interaction/form/NumberInput/NumberInput.stories.tsx +63 -0
- package/src/components/interaction/form/NumberInput/NumberInput.tsx +198 -0
- package/src/components/interaction/form/Radio/Radio.spec.tsx +79 -0
- package/src/components/interaction/form/Radio/Radio.stories.tsx +44 -0
- package/src/components/interaction/form/Radio/Radio.tsx +79 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.mdx +79 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.spec.tsx +66 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.stories.tsx +96 -0
- package/src/components/interaction/form/RadioGroup/RadioGroup.tsx +61 -0
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.mdx +78 -0
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.spec.tsx +82 -0
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.stories.tsx +99 -0
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.tsx +121 -0
- package/src/components/interaction/form/Select/Select.mdx +85 -0
- package/src/components/interaction/form/Select/Select.spec.tsx +64 -0
- package/src/components/interaction/form/Select/Select.stories.tsx +75 -0
- package/src/components/interaction/form/Select/Select.tsx +252 -0
- package/src/components/interaction/form/Slider/Slider.mdx +83 -0
- package/src/components/interaction/form/Slider/Slider.spec.tsx +51 -0
- package/src/components/interaction/form/Slider/Slider.stories.tsx +58 -0
- package/src/components/interaction/form/Slider/Slider.tsx +188 -0
- package/src/components/interaction/form/Switch/Switch.spec.tsx +60 -0
- package/src/components/interaction/form/Switch/Switch.stories.tsx +33 -0
- package/src/components/interaction/form/Switch/Switch.tsx +59 -0
- package/src/components/interaction/form/Textarea/Textarea.mdx +76 -0
- package/src/components/interaction/form/Textarea/Textarea.spec.tsx +50 -0
- package/src/components/interaction/form/Textarea/Textarea.stories.tsx +50 -0
- package/src/components/interaction/form/Textarea/Textarea.tsx +108 -0
- package/src/components/interaction/form/atoms/Label.spec.tsx +39 -0
- package/src/components/interaction/form/atoms/Label.stories.tsx +18 -0
- package/src/components/interaction/form/atoms/Label.tsx +29 -0
- package/src/components/interaction/form/atoms/Message.spec.tsx +30 -0
- package/src/components/interaction/form/atoms/Message.stories.tsx +22 -0
- package/src/components/interaction/form/atoms/Message.tsx +34 -0
- package/src/components/layout/ButtonGroup/ButtonGroup.spec.tsx +83 -0
- package/src/components/layout/ButtonGroup/ButtonGroup.stories.tsx +44 -0
- package/src/components/layout/ButtonGroup/ButtonGroup.tsx +44 -0
- package/src/components/layout/Card/Card.spec.tsx +102 -0
- package/src/components/layout/Card/Card.stories.tsx +51 -0
- package/src/components/layout/Card/Card.tsx +89 -0
- package/src/components/layout/IconWrapper/IconWrapper.spec.tsx +39 -0
- package/src/components/layout/IconWrapper/IconWrapper.stories.tsx +37 -0
- package/src/components/layout/IconWrapper/IconWrapper.tsx +20 -0
- package/src/components/layout/SectionHeader/SectionHeader.spec.tsx +51 -0
- package/src/components/layout/SectionHeader/SectionHeader.stories.tsx +36 -0
- package/src/components/layout/SectionHeader/SectionHeader.tsx +79 -0
- package/src/components/ui/Accordion/Accordion.mdx +65 -0
- package/src/components/ui/Accordion/Accordion.spec.tsx +69 -0
- package/src/components/ui/Accordion/Accordion.stories.tsx +52 -0
- package/src/components/ui/Accordion/Accordion.tsx +141 -0
- package/src/components/ui/Alert/Alert.mdx +62 -0
- package/src/components/ui/Alert/Alert.spec.tsx +76 -0
- package/src/components/ui/Alert/Alert.stories.tsx +41 -0
- package/src/components/ui/Alert/Alert.tsx +94 -0
- package/src/components/ui/Avatar/Avatar.mdx +50 -0
- package/src/components/ui/Avatar/Avatar.spec.tsx +47 -0
- package/src/components/ui/Avatar/Avatar.stories.tsx +32 -0
- package/src/components/ui/Avatar/Avatar.tsx +85 -0
- package/src/components/ui/Badge/Badge.mdx +54 -0
- package/src/components/ui/Badge/Badge.spec.tsx +45 -0
- package/src/components/ui/Badge/Badge.stories.tsx +34 -0
- package/src/components/ui/Badge/Badge.tsx +50 -0
- package/src/components/ui/Breadcrumb/Breadcrumb.mdx +52 -0
- package/src/components/ui/Breadcrumb/Breadcrumb.spec.tsx +49 -0
- package/src/components/ui/Breadcrumb/Breadcrumb.stories.tsx +46 -0
- package/src/components/ui/Breadcrumb/Breadcrumb.tsx +83 -0
- package/src/components/ui/Calendar/Calendar.mdx +58 -0
- package/src/components/ui/Calendar/Calendar.spec.tsx +92 -0
- package/src/components/ui/Calendar/Calendar.stories.tsx +45 -0
- package/src/components/ui/Calendar/Calendar.tsx +294 -0
- package/src/components/ui/Carousel/Carousel.mdx +55 -0
- package/src/components/ui/Carousel/Carousel.spec.tsx +55 -0
- package/src/components/ui/Carousel/Carousel.stories.tsx +59 -0
- package/src/components/ui/Carousel/Carousel.tsx +184 -0
- package/src/components/ui/Collapsible/Collapsible.mdx +53 -0
- package/src/components/ui/Collapsible/Collapsible.spec.tsx +68 -0
- package/src/components/ui/Collapsible/Collapsible.stories.tsx +48 -0
- package/src/components/ui/Collapsible/Collapsible.tsx +139 -0
- package/src/components/ui/DescriptionList/DescriptionList.mdx +50 -0
- package/src/components/ui/DescriptionList/DescriptionList.spec.tsx +37 -0
- package/src/components/ui/DescriptionList/DescriptionList.stories.tsx +48 -0
- package/src/components/ui/DescriptionList/DescriptionList.tsx +54 -0
- package/src/components/ui/Link/Link.mdx +53 -0
- package/src/components/ui/Link/Link.spec.tsx +35 -0
- package/src/components/ui/Link/Link.stories.tsx +46 -0
- package/src/components/ui/Link/Link.tsx +48 -0
- package/src/components/ui/Loading/Loading.spec.tsx +24 -0
- package/src/components/ui/Loading/Loading.stories.tsx +31 -0
- package/src/components/ui/Loading/Loading.tsx +29 -0
- package/src/components/ui/NotificationBanner/NotificationBanner.spec.tsx +85 -0
- package/src/components/ui/NotificationBanner/NotificationBanner.stories.tsx +37 -0
- package/src/components/ui/NotificationBanner/NotificationBanner.tsx +76 -0
- package/src/components/ui/Pagination/Pagination.mdx +62 -0
- package/src/components/ui/Pagination/Pagination.spec.tsx +86 -0
- package/src/components/ui/Pagination/Pagination.stories.tsx +47 -0
- package/src/components/ui/Pagination/Pagination.tsx +157 -0
- package/src/components/ui/Progress/Progress.spec.tsx +56 -0
- package/src/components/ui/Progress/Progress.stories.tsx +34 -0
- package/src/components/ui/Progress/Progress.tsx +84 -0
- package/src/components/ui/ProgressCircle/ProgressCircle.mdx +63 -0
- package/src/components/ui/ProgressCircle/ProgressCircle.spec.tsx +39 -0
- package/src/components/ui/ProgressCircle/ProgressCircle.stories.tsx +36 -0
- package/src/components/ui/ProgressCircle/ProgressCircle.tsx +176 -0
- package/src/components/ui/Separator/Separator.spec.tsx +39 -0
- package/src/components/ui/Separator/Separator.stories.tsx +38 -0
- package/src/components/ui/Separator/Separator.tsx +32 -0
- package/src/components/ui/Skeleton/Skeleton.spec.tsx +39 -0
- package/src/components/ui/Skeleton/Skeleton.stories.tsx +31 -0
- package/src/components/ui/Skeleton/Skeleton.tsx +42 -0
- package/src/components/ui/Table/Table.mdx +72 -0
- package/src/components/ui/Table/Table.spec.tsx +83 -0
- package/src/components/ui/Table/Table.stories.tsx +55 -0
- package/src/components/ui/Table/Table.tsx +196 -0
- package/src/components/ui/Tabs/Tabs.mdx +65 -0
- package/src/components/ui/Tabs/Tabs.spec.tsx +65 -0
- package/src/components/ui/Tabs/Tabs.stories.tsx +57 -0
- package/src/components/ui/Tabs/Tabs.tsx +133 -0
- package/src/components/ui/Tooltip/Tooltip.mdx +47 -0
- package/src/components/ui/Tooltip/Tooltip.spec.tsx +37 -0
- package/src/components/ui/Tooltip/Tooltip.stories.tsx +38 -0
- package/src/components/ui/Tooltip/Tooltip.tsx +57 -0
- package/src/components/ui/Typography/Typography.mdx +56 -0
- package/src/components/ui/Typography/Typography.spec.tsx +49 -0
- package/src/components/ui/Typography/Typography.stories.tsx +36 -0
- package/src/components/ui/Typography/Typography.tsx +65 -0
- package/src/index.ts +86 -0
- package/src/native/ReactNavigationTheme.mdx +140 -0
- package/src/native/ReactNavigationTheme.spec.tsx +35 -0
- package/src/native/ReactNavigationTheme.ts +102 -0
- package/src/native/ThemeContext.spec.tsx +57 -0
- package/src/native/ThemeContext.tsx +48 -0
- package/src/native/tokens.ts +13 -0
- package/src/test/setup.ts +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@boostdev/design-system-react-native` are documented here.
|
|
4
|
+
## [0.2.0] - 2026-06-10
|
|
5
|
+
### Added
|
|
6
|
+
- Feat: rename Drawer to SideSheet, optional @react-navigation/native peer, nav theme docs, git-cliff ([`42e165d`](https://gitlab.com/b00stdev/boostdev-design-system-react-native/-/commit/42e165d6df397876df8b721122259af640eeaa98))
|
|
7
|
+
- Feat(theme): tokens override prop on ThemeProvider, widen ThemeColors to string ([`6fd6e79`](https://gitlab.com/b00stdev/boostdev-design-system-react-native/-/commit/6fd6e7966f9fb7d5040ba15e748cae02a8d3f023))
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- Update .gitignore to exclude IntelliJ IDEA project files ([`006a8c2`](https://gitlab.com/b00stdev/boostdev-design-system-react-native/-/commit/006a8c2a44611a64f82ec3e1eaf5f03469ab40c4))
|
|
11
|
+
- Refactor CI pipeline, add `git-cliff` for changelog generation
|
|
12
|
+
|
|
13
|
+
- Overhauled `.gitlab-ci.yml` with new stages: install, validate, deploy
|
|
14
|
+
- Replaced `default` job with reusable `.pnpm_setup` and validation rules
|
|
15
|
+
- Added `git-cliff` for automated changelog updates and `auto-tag` workflow
|
|
16
|
+
- Updated dependencies in `package.json` and `pnpm-lock.yaml` ([`004050f`](https://gitlab.com/b00stdev/boostdev-design-system-react-native/-/commit/004050fb18b2f0ee1c65c44c769faf92bced3222))
|
|
17
|
+
|
|
18
|
+
### Other
|
|
19
|
+
- Initial commit ([`1b50bbf`](https://gitlab.com/b00stdev/boostdev-design-system-react-native/-/commit/1b50bbfcda43e91e580c94ed793979b458fecb1f))
|
|
20
|
+
- Extract @boostdev/design-system-react-native from boostcomponents
|
|
21
|
+
|
|
22
|
+
Extracts the React Native subset (50+ components, theme, tokens) from
|
|
23
|
+
@boostdev/design-system-components into a standalone npm package.
|
|
24
|
+
|
|
25
|
+
- src/native/ThemeContext + tokens
|
|
26
|
+
- *.native.tsx implementations across ui, layout, interaction, form, atoms
|
|
27
|
+
- *.native.spec.tsx (297 tests, all passing)
|
|
28
|
+
- tsup build (esm + cjs + dts)
|
|
29
|
+
- vitest via react-native-web alias ([`5927caf`](https://gitlab.com/b00stdev/boostdev-design-system-react-native/-/commit/5927cafd024c3f9697b7a723fd9cad07777cdd2c))
|
|
30
|
+
- Rename .native.* to .*, add stories/mdx, Storybook, CI, LICENSE
|
|
31
|
+
|
|
32
|
+
- Drop .native suffix from all files (everything here is native)
|
|
33
|
+
- Restore *.stories.tsx and *.mdx from boostcomponents history
|
|
34
|
+
- Storybook 8 (react-vite) with react-native-web alias, ThemeProvider decorator, light/dark toolbar toggle
|
|
35
|
+
- .gitlab-ci.yml: typecheck, test, build stages
|
|
36
|
+
- LICENSE (ISC)
|
|
37
|
+
- tsconfig: exclude stories from typecheck
|
|
38
|
+
- gitignore: storybook-static, .pnpm-store ([`f19ba7f`](https://gitlab.com/b00stdev/boostdev-design-system-react-native/-/commit/f19ba7fa558dba4b26128898020c50d00e58cf0a))
|
|
39
|
+
- Test(theme): pin nav theme inheritance of token overrides ([`8c2fbc8`](https://gitlab.com/b00stdev/boostdev-design-system-react-native/-/commit/8c2fbc8a789ca43604cdc498bbadf2185e8f6433))
|
|
40
|
+
- Docs: brand theming via tokens overrides, expo-router nav theme recipe ([`3a23e97`](https://gitlab.com/b00stdev/boostdev-design-system-react-native/-/commit/3a23e9730cc05fa3917f5237c88a55c50b57617b))
|
|
41
|
+
|
|
42
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Boostdev
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -15,8 +15,11 @@ Peer dependencies:
|
|
|
15
15
|
- `react` >= 18
|
|
16
16
|
- `react-native` >= 0.70
|
|
17
17
|
- `@boostdev/design-system-foundation` >= 2.0.0
|
|
18
|
+
- `@react-navigation/native` >= 6.0.0 *(optional — only needed if you use the React Navigation bridge below)*
|
|
18
19
|
|
|
19
|
-
##
|
|
20
|
+
## Standalone usage
|
|
21
|
+
|
|
22
|
+
The library is fully self-contained. Wrap your app in `ThemeProvider` and use components directly — no other dependencies required.
|
|
20
23
|
|
|
21
24
|
```tsx
|
|
22
25
|
import { ThemeProvider, Button, Typography } from '@boostdev/design-system-react-native';
|
|
@@ -31,7 +34,106 @@ export default function App() {
|
|
|
31
34
|
}
|
|
32
35
|
```
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
`ThemeProvider` auto-detects the system color scheme (light/dark) via `useColorScheme`, or you can pass `colorScheme="light" | "dark"` to force one. Inside the tree, `useTheme()` exposes `{ colors, isDark }` where `colors` is the full foundation token palette (`colorBg`, `colorOnBg`, `colorInteractive`, …).
|
|
38
|
+
|
|
39
|
+
## Brand theming (token overrides)
|
|
40
|
+
|
|
41
|
+
Override any semantic color per scheme — the React Native equivalent of the web
|
|
42
|
+
`boostdev.tokens.override` CSS layer. One prop recolors every component **and**
|
|
43
|
+
`useReactNavigationTheme`:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { ThemeProvider } from '@boostdev/design-system-react-native';
|
|
47
|
+
|
|
48
|
+
<ThemeProvider
|
|
49
|
+
tokens={{
|
|
50
|
+
light: { colorInteractive: '#00c853', colorInteractiveOnBg: '#2d5a1e' },
|
|
51
|
+
dark: { colorInteractive: '#00c853', colorInteractiveOnBg: '#a8d48a' },
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<App />
|
|
55
|
+
</ThemeProvider>;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Unspecified tokens keep their foundation values. Available token names are the keys of
|
|
59
|
+
`colors.light` from `@boostdev/design-system-foundation/native` (`colorBg`,
|
|
60
|
+
`colorInteractive`, `colorError`, …) — see the `ThemeColorName` type.
|
|
61
|
+
|
|
62
|
+
Pass a stable `tokens` reference (a module-level constant, not an inline object
|
|
63
|
+
literal) — the provider memoizes the merged colors on that reference.
|
|
64
|
+
|
|
65
|
+
## React Navigation compatibility
|
|
66
|
+
|
|
67
|
+
The library also ships a thin, **opt-in** bridge that produces a [React Navigation](https://reactnavigation.org/) `Theme` from the same foundation tokens. The bridge is purely additive — nothing about the standalone API changes when you use it, and `@react-navigation/native` is only required if you actually consume the bridge.
|
|
68
|
+
|
|
69
|
+
### Hook variant — when you wrap in `ThemeProvider`
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { NavigationContainer } from '@react-navigation/native';
|
|
73
|
+
import { ThemeProvider, useReactNavigationTheme } from '@boostdev/design-system-react-native';
|
|
74
|
+
|
|
75
|
+
function NavRoot({ children }) {
|
|
76
|
+
const theme = useReactNavigationTheme();
|
|
77
|
+
return <NavigationContainer theme={theme}>{children}</NavigationContainer>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default function App() {
|
|
81
|
+
return (
|
|
82
|
+
<ThemeProvider>
|
|
83
|
+
<NavRoot>{/* screens */}</NavRoot>
|
|
84
|
+
</ThemeProvider>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`useReactNavigationTheme()` reads from our `ThemeProvider` and reflects light/dark switches automatically. It accepts optional `{ colors, fonts }` overrides.
|
|
90
|
+
|
|
91
|
+
### Builder variant — standalone or outside React
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { NavigationContainer } from '@react-navigation/native';
|
|
95
|
+
import { createReactNavigationTheme } from '@boostdev/design-system-react-native';
|
|
96
|
+
|
|
97
|
+
const theme = createReactNavigationTheme({ dark: false });
|
|
98
|
+
|
|
99
|
+
<NavigationContainer theme={theme}>{/* … */}</NavigationContainer>;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`createReactNavigationTheme(options)` is a pure function. Use it when you do not wrap in `ThemeProvider`, or when you need a theme outside React (tests, navigators created at module scope, etc.).
|
|
103
|
+
|
|
104
|
+
Options:
|
|
105
|
+
|
|
106
|
+
| Option | Type | Description |
|
|
107
|
+
| -------- | ----------------------------------- | ------------------------------------------------------------------------ |
|
|
108
|
+
| `dark` | `boolean` | Selects the dark token set. Default `false`. |
|
|
109
|
+
| `tokens` | `colors.light \| colors.dark` shape | Bring your own foundation token set. Defaults to `colors[dark ? 'dark' : 'light']` from the foundation. |
|
|
110
|
+
| `colors` | `Partial<ReactNavigationThemeColors>` | Override individual Navigation colors (e.g. `{ primary: '#ff0' }`). |
|
|
111
|
+
| `fonts` | `Partial<ReactNavigationThemeFonts>` | Override individual Navigation font styles. |
|
|
112
|
+
|
|
113
|
+
### Token mapping
|
|
114
|
+
|
|
115
|
+
The bridge maps foundation tokens to React Navigation's six-color palette. The mapping lives in this repo (`src/native/ReactNavigationTheme.ts`) — the foundation package stays generic.
|
|
116
|
+
|
|
117
|
+
| React Navigation | Foundation token |
|
|
118
|
+
| ---------------- | --------------------------------------------- |
|
|
119
|
+
| `primary` | `colorInteractive` |
|
|
120
|
+
| `background` | `colorBg` |
|
|
121
|
+
| `card` | `colorBgSubtle` |
|
|
122
|
+
| `text` | `colorOnBg` |
|
|
123
|
+
| `border` | `palette.grey200` (light) / `grey700` (dark) |
|
|
124
|
+
| `notification` | `colorError` |
|
|
125
|
+
|
|
126
|
+
Fonts use `font.family.body` with weights from `font.weight` (`body`, `medium`, `bold`, `heading`).
|
|
127
|
+
|
|
128
|
+
Override any of these per-call via the `colors` / `fonts` options without changing the foundation.
|
|
129
|
+
|
|
130
|
+
### Custom themes
|
|
131
|
+
|
|
132
|
+
Both standalone (`useTheme`) and Navigation (`useReactNavigationTheme` / `createReactNavigationTheme`) consume the same foundation tokens. To build a custom theme:
|
|
133
|
+
|
|
134
|
+
1. Author a token set matching the foundation's `colors.light` / `colors.dark` shape.
|
|
135
|
+
2. Pass it as `tokens` to `createReactNavigationTheme({ tokens, dark })` for the Navigation layer.
|
|
136
|
+
3. For the standalone layer — and to have overrides flow through to the Navigation theme automatically — use the `tokens` prop on `ThemeProvider` (see [Brand theming](#brand-theming-token-overrides) above).
|
|
35
137
|
|
|
36
138
|
## Development
|
|
37
139
|
|