@onekeyfe/react-native-bottom-tabs 6.7.0-46 → 6.7.0-48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +139 -48
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,66 +1,158 @@
1
+ <div align="center">
2
+
1
3
  # @onekeyfe/react-native-bottom-tabs
2
4
 
3
- Native bottom-tab navigation for OneKey React Native applications on iOS and
4
- Android. The controlled React component receives route state from the caller
5
- and renders scenes through the application's supplied renderer.
5
+ **Native bottom-tab navigation for OneKey apps on iOS and Android — the platform owns the tab bar, the application owns routing.**
6
+
7
+ [![npm](https://img.shields.io/npm/v/%40onekeyfe%2Freact-native-bottom-tabs?label=npm&color=4D6BFE)](https://www.npmjs.com/package/@onekeyfe/react-native-bottom-tabs)
8
+ [![license](https://img.shields.io/npm/l/%40onekeyfe%2Freact-native-bottom-tabs?label=license&color=4D6BFE)](LICENSE)
9
+ ![iOS](https://img.shields.io/badge/iOS-000000?logo=apple&logoColor=white)
10
+ ![Android](https://img.shields.io/badge/Android-3DDC84?logo=android&logoColor=white)
11
+ ![Fabric](https://img.shields.io/badge/Fabric-4D6BFE)
12
+
13
+ </div>
14
+
15
+ A controlled tab container that renders the real `UITabBarController` on iOS and a
16
+ Material or floating native bar on Android, while the application supplies the
17
+ navigation state and scene components. Tab selection, badges, icons, lazy scene
18
+ mounting, double-press detection and the optional left drawer are handled by the
19
+ native view. The package targets iOS and Android only; it has no Web
20
+ implementation and no route definitions of its own.
21
+
22
+ ## Features
23
+
24
+ - **Platform-native tab bars** — UIKit tab bar on iOS, Material
25
+ `BottomNavigationView` or a floating capsule bar on Android, with the system's
26
+ own gestures and insets.
27
+ - **Controlled navigation state** — pass `{ index, routes }`, render scenes from
28
+ stable route keys, and update your own state in `onIndexChange`.
29
+ - **Lazy and frozen scenes** — `lazy`/`getLazy` and `freezeOnBlur` control when a
30
+ scene mounts and whether it keeps rendering in the background.
31
+ - **Rich tab metadata** — labels, badges, tints, SF Symbols, named icons, image
32
+ sources, hidden tabs, test IDs and roles.
33
+ - **Native drawer and Android options** — an optional physical-left menu, a
34
+ floating bar with live blur on Android 16+, ripple and inset controls.
6
35
 
7
- ## Installation and usage
36
+ ## Installation
8
37
 
9
38
  ```sh
10
- yarn add @onekeyfe/react-native-bottom-tabs
39
+ yarn add @onekeyfe/react-native-bottom-tabs @onekeyfe/react-native-image
11
40
  ```
12
41
 
13
- Install the application's iOS pods and rebuild the native application to register
14
- the bottom tabs. The application owns route definitions and selection state.
42
+ Peer dependencies: `react`, `react-native` and `@onekeyfe/react-native-image`,
43
+ which provides the native SVG decoder for named and SVG tab icons. The package
44
+ registers native views, so install the app's iOS pods and rebuild the native
45
+ binary; a JavaScript-only install does not register the tab bar:
46
+
47
+ ```sh
48
+ cd ios && pod install
49
+ ```
50
+
51
+ Android links through autolinking; deployment floors are iOS 15.1 and Android
52
+ API 24.
53
+
54
+ ## Usage
15
55
 
16
56
  ```tsx
17
57
  import { useState } from 'react';
18
58
  import { Text } from 'react-native';
19
- import BottomTabs from '@onekeyfe/react-native-bottom-tabs';
59
+ import BottomTabs, { SceneMap } from '@onekeyfe/react-native-bottom-tabs';
60
+
61
+ const HomeScene = () => <Text>Home</Text>;
62
+ const SettingsScene = () => <Text>Settings</Text>;
20
63
 
21
- const routes = [{ key: 'home', title: 'Home' }, { key: 'settings', title: 'Settings' }];
64
+ const renderScene = SceneMap({ home: HomeScene, settings: SettingsScene });
22
65
 
23
- function Tabs() {
66
+ const routes = [
67
+ { key: 'home', title: 'Home' },
68
+ { key: 'settings', title: 'Settings', badge: '3' },
69
+ ];
70
+
71
+ export function AppTabs() {
24
72
  const [index, setIndex] = useState(0);
25
73
  return (
26
74
  <BottomTabs
27
75
  navigationState={{ index, routes }}
28
76
  onIndexChange={setIndex}
29
- renderScene={({ route }) => <Text>{route.title}</Text>}
77
+ renderScene={renderScene}
30
78
  />
31
79
  );
32
80
  }
33
81
  ```
34
82
 
35
- Earlier releases were published as `@onekeyfe/react-native-tab-view`, where
36
- the default export was `TabView` and `onTabLongPress` existed.
37
-
38
- ## State, scenes and platform options
39
-
40
- `navigationState` contains the selected index and keyed routes. `onIndexChange`
41
- reports requested tab changes; update state in the caller. Route metadata can
42
- supply labels, badges and icons. `SceneMap` builds a renderer from stable scene
43
- components; `useBottomTabBarHeight` and `BottomTabBarHeightContext` expose tab-bar
44
- height to content under the provider.
45
-
46
- The default export is `BottomTabs`; `AppleIcon` and `TabRole` are exported types.
47
- Some appearance and interaction options are platform-specific, including Apple
48
- symbols and newer iOS tab-bar presentation. Check those options against the
49
- consumer's supported OS versions rather than assuming identical native layouts.
50
-
51
- On Android, `androidBottomBlurEnabled` controls live background blur, translucent
52
- tint, and a gradient above the native bar. It defaults to enabled on Android 16+
53
- (API 36); pass `false` to disable it or `true` to enable it on Android 12–15.
54
- Earlier Android versions retain the standard bar. It is ignored on iOS and with
55
- a custom `tabBar`. When enabled, scenes extend behind the bar: use
56
- `useBottomTabBarHeight()` as scroll-content bottom padding so the last row can
57
- scroll above it. `tabBarStyle.backgroundColor` sets the surface tint.
58
-
59
- See [src/BottomTabs.tsx](src/BottomTabs.tsx) for component props and
60
- [src/types.ts](src/types.ts) for route definitions.
61
-
62
- See [docs/SPEC.md](docs/SPEC.md) for native touch-selection contracts and
63
- acceptance boundaries.
83
+ The application owns routes, selection state and scene content; the native view
84
+ owns the tab bar, gestures and scene freezing. Keep the `routes` array stable
85
+ unless the route definitions actually change.
86
+
87
+ ## API
88
+
89
+ ### Exports
90
+
91
+ | Export | Platforms | Description |
92
+ | --- | :-: | --- |
93
+ | `BottomTabs` (default) | iOS, Android | Controlled native tab container and scene host. |
94
+ | `SceneMap` | iOS, Android | Builds a `renderScene` function from a route-key → component map. |
95
+ | `useBottomTabBarHeight()` | iOS, Android | Native tab-bar height in logical units (`0` while hidden); must be inside the tab container. |
96
+ | `BottomTabBarHeightContext` | iOS, Android | Context that provides the same height to scene content. |
97
+ | `AppleIcon`, `NamedIcon`, `BottomTabIconSource`, `TabRole`, `TabBarPlacement` | iOS, Android | Icon and tab typing helpers, including `{ sfSymbol }` and `{ iconName }`. |
98
+
99
+ ### `BottomTabs` props
100
+
101
+ | Prop | Type | Platforms | Description |
102
+ | --- | --- | :-: | --- |
103
+ | `navigationState`, `renderScene` | `{ index, routes }`, function | iOS, Android | Required selected index, keyed routes and scene renderer. |
104
+ | `onIndexChange`, `onTabDoublePress` | callbacks | iOS, Android | Tab change; second press on the selected tab within the platform double-tap timeout. |
105
+ | `renderLazyPlaceholder`, `getLazy`, `getFreezeOnBlur`, `getSceneStyle` | functions | iOS, Android | Lazy placeholder, per-route lazy/freeze and scene style. |
106
+ | `getLabelText`, `getBadge`, `getIcon`, `getHidden`, `getTestID`, `getActiveTintColor` | functions | iOS, Android | Per-route metadata and tint resolvers; each defaults to the matching route field. |
107
+ | `getRole` | function | iOS | System search-tab role. |
108
+ | `getBadgeBackgroundColor`, `getBadgeTextColor` | functions | Android | Badge background and text colors. |
109
+ | `tabBar`, `tabBarStyle`, `tabLabelStyle`, `tabBarActiveTintColor`, `tabBarInactiveTintColor` | component/props | iOS, Android | Custom JS bar replacing the native bar, plus bar background, label font and tints. |
110
+ | `tabBarHidden`, `labeled`, `hapticFeedbackEnabled`, `delayedFreeze` | `boolean` | iOS, Android | Visibility, labels, haptics and delayed freeze/unfreeze. |
111
+ | `translucent`, `disablePageAnimations`, `sidebarAdaptable`, `scrollEdgeAppearance` | platform options | iOS | Translucency, page animations, adaptable/sidebar style and scroll-edge appearance. |
112
+ | `minimizeBehavior`, `renderBottomAccessoryView` | options | iOS 26+ | Tab-bar minimizing behavior and an accessory view above the bar. |
113
+ | `onTabBarPlacementChange`, `sideAccessoryIcon`, `onSideAccessoryPress` | event/style props | iOS | Vertical placement (iPhone Duo) and its side accessory button. |
114
+ | `androidTabBarStyle`, `androidBottomBlurEnabled` | platform props | Android | Material docked or floating capsule bar; live blur defaults on for Android 16+. |
115
+ | `rippleColor`, `activeIndicatorColor`, `ignoreBottomInsets`, `ignoreKeyboardInsets` | platform props | Android | Ripple, indicator, navigation-bar and keyboard inset controls. |
116
+ | `renderDrawerContent`, `drawerOpen`, `drawerSwipeEnabled`, `onDrawerOpenChange` | drawer props | iOS, Android | Optional native left drawer and its controlled state. |
117
+
118
+ Route fields such as `title`, `badge`, `focusedIcon`, `unfocusedIcon`, `lazy`,
119
+ `hidden`, `role`, `preventsDefault` and `freezeOnBlur` mirror the resolvers above;
120
+ see [`src/types.ts`](src/types.ts) and [`src/BottomTabs.tsx`](src/BottomTabs.tsx).
121
+
122
+ ## Platform support
123
+
124
+ | Capability | iOS | Android |
125
+ | --- | :-: | :-: |
126
+ | Native tab bar, selection and scenes | ✅ | ✅ |
127
+ | Lazy scenes and freeze-on-blur | ✅ | ✅ |
128
+ | Labels, badges and icon sources | ✅ | ✅ |
129
+ | Native left drawer | ✅ | ✅ |
130
+ | Double press with scroll-to-top | ✅ | ✅ |
131
+ | Floating capsule bar and live background blur | — | ✅ |
132
+ | Bottom accessory view, minimize behavior, vertical placement | ✅ iOS 26+ | — |
133
+
134
+ ## Caveats
135
+
136
+ > [!WARNING]
137
+ > This package has no Web implementation. It targets the iOS and Android native
138
+ > tab bar only; do not mount it in a Web bundle.
139
+
140
+ > [!IMPORTANT]
141
+ > Android supports at most 100 tabs. Routes beyond the first 100 are dropped with
142
+ > a console warning, so keep the navigation state within that bound.
143
+
144
+ > [!NOTE]
145
+ > Tab long press is not supported: `onTabLongPress` and the native long-press
146
+ > recognizers were removed. Use `onTabDoublePress` for a second press on the
147
+ > already selected tab.
148
+
149
+ ## References
150
+
151
+ - [Behavioral contract](docs/SPEC.md)
152
+ - Example pages: [test page](../../example/react-native/pages/BottomTabsTestPage.tsx)
153
+ and [drawer page](../../example/react-native/pages/BottomTabsHomeDrawerExample.tsx)
154
+ - [npm package](https://www.npmjs.com/package/@onekeyfe/react-native-bottom-tabs)
155
+ - [Changelog](../../CHANGELOG.md)
64
156
 
65
157
  ## Upstream attribution
66
158
 
@@ -80,16 +172,15 @@ unable to keep this work in patch form.
80
172
  As the gap grew, we ultimately forked `react-native-bottom-tabs` to keep
81
173
  development and delivery stable.
82
174
 
83
- ## Upstream Project
84
-
85
- - Repository: [okwasniewski/react-native-bottom-tabs](https://github.com/okwasniewski/react-native-bottom-tabs)
175
+ - Upstream repository:
176
+ [okwasniewski/react-native-bottom-tabs](https://github.com/okwasniewski/react-native-bottom-tabs)
86
177
  - License: MIT
87
-
88
- ## Notes
89
-
90
178
  - This fork includes OneKey-specific adaptations for our product requirements.
91
- - If you are looking for original behavior and full documentation, please refer
92
- to the upstream repository.
179
+ - For original behavior and full documentation, refer to the upstream repository.
93
180
 
94
181
  Thank you again to Oskar Kwaśniewski and everyone who contributes to
95
182
  `react-native-bottom-tabs` 💙
183
+
184
+ ## License
185
+
186
+ MIT. See [LICENSE](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-bottom-tabs",
3
- "version": "6.7.0-46",
3
+ "version": "6.7.0-48",
4
4
  "description": "Native bottom tabs (tab bar + scene container) for React Native on iOS and Android",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",