@onekeyfe/react-native-bottom-tabs 6.7.0-18 → 6.7.0-20
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/android/src/main/java/com/onekey/bottomtabs/BottomTabsDrawerManager.kt +55 -0
- package/android/src/main/java/com/onekey/bottomtabs/BottomTabsDrawerView.kt +496 -0
- package/android/src/main/java/com/onekey/bottomtabs/BottomTabsPackage.kt +1 -1
- package/android/src/main/java/com/onekey/bottomtabs/BottomTabsViewManager.kt +3 -0
- package/docs/SPEC.md +163 -2
- package/ios/RCTBottomTabsComponentView.mm +37 -0
- package/ios/RCTBottomTabsContainerView.swift +192 -7
- package/ios/RCTBottomTabsDrawerComponentView.h +8 -0
- package/ios/RCTBottomTabsDrawerComponentView.mm +79 -0
- package/ios/RCTBottomTabsDrawerContainerView.swift +327 -0
- package/lib/module/BottomTabs.js +144 -87
- package/lib/module/BottomTabsDrawerNativeComponent.ts +19 -0
- package/lib/module/BottomTabsDrawerNativeComponent.web.js +13 -0
- package/lib/module/BottomTabsNativeComponent.ts +13 -0
- package/lib/typescript/src/BottomTabs.d.ts +36 -10
- package/lib/typescript/src/BottomTabsDrawerNativeComponent.d.ts +15 -0
- package/lib/typescript/src/BottomTabsDrawerNativeComponent.web.d.ts +4 -0
- package/lib/typescript/src/BottomTabsNativeComponent.d.ts +8 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/types.d.ts +1 -0
- package/package.json +3 -2
- package/react-native.config.js +4 -1
- package/src/BottomTabs.tsx +235 -115
- package/src/BottomTabsDrawerNativeComponent.ts +19 -0
- package/src/BottomTabsDrawerNativeComponent.web.tsx +9 -0
- package/src/BottomTabsNativeComponent.ts +13 -0
- package/src/index.tsx +1 -1
- package/src/types.ts +3 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { codegenNativeComponent, type ViewProps } from "react-native";
|
|
2
|
+
import type {
|
|
3
|
+
DirectEventHandler,
|
|
4
|
+
Double,
|
|
5
|
+
WithDefault,
|
|
6
|
+
} from "react-native/Libraries/Types/CodegenTypes";
|
|
7
|
+
|
|
8
|
+
export interface BottomTabsDrawerNativeProps extends ViewProps {
|
|
9
|
+
enabled?: WithDefault<boolean, false>;
|
|
10
|
+
open?: WithDefault<boolean, false>;
|
|
11
|
+
swipeEnabled?: WithDefault<boolean, false>;
|
|
12
|
+
hapticFeedbackEnabled?: WithDefault<boolean, false>;
|
|
13
|
+
bottomBarHeight?: Double;
|
|
14
|
+
onDrawerOpenChange?: DirectEventHandler<Readonly<{ open: boolean }>>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default codegenNativeComponent<BottomTabsDrawerNativeProps>(
|
|
18
|
+
"RNBottomTabsDrawer"
|
|
19
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
// The fixed first slot is the menu; Web only renders the foreground slot.
|
|
6
|
+
export default function BottomTabsDrawerWeb({
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
9
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
10
|
+
children: React.Children.toArray(children)[1]
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=BottomTabsDrawerNativeComponent.web.js.map
|
|
@@ -22,6 +22,14 @@ export type OnNativeLayout = Readonly<{
|
|
|
22
22
|
height: Double;
|
|
23
23
|
}>;
|
|
24
24
|
|
|
25
|
+
// Where the system draws the tab bar: 'bottom', or 'leading' / 'trailing' for
|
|
26
|
+
// a vertical bar (the iPhone Duo side strip, iOS 27.1+).
|
|
27
|
+
export type OnTabBarPlacementChange = Readonly<{
|
|
28
|
+
placement: string;
|
|
29
|
+
}>;
|
|
30
|
+
|
|
31
|
+
export type OnSideAccessoryPress = Readonly<{}>;
|
|
32
|
+
|
|
25
33
|
export type BottomTabsItems = ReadonlyArray<{
|
|
26
34
|
key: string;
|
|
27
35
|
title: string;
|
|
@@ -65,6 +73,11 @@ export interface BottomTabsNativeProps extends ViewProps {
|
|
|
65
73
|
ignoreBottomInsets?: boolean;
|
|
66
74
|
androidTabBarStyle?: WithDefault<'default' | 'floating', 'default'>;
|
|
67
75
|
ignoreKeyboardInsets?: WithDefault<boolean, true>;
|
|
76
|
+
onTabBarPlacementChange?: DirectEventHandler<OnTabBarPlacementChange>;
|
|
77
|
+
// A round button drawn above a vertical tab bar; iOS only.
|
|
78
|
+
sideAccessoryIcon?: ImageSource;
|
|
79
|
+
sideAccessoryLabel?: string;
|
|
80
|
+
onSideAccessoryPress?: DirectEventHandler<OnSideAccessoryPress>;
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
export default codegenNativeComponent<BottomTabsNativeProps>('RNBottomTabsView');
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { type ColorValue, type StyleProp, type ViewStyle } from
|
|
3
|
-
import type { ImageSource } from
|
|
4
|
-
import type { AppleIcon, BaseRoute, NavigationState, TabRole } from
|
|
5
|
-
import { type RNBottomTabsAccessoryViewProps } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ColorValue, type ImageSourcePropType, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import type { ImageSource } from "react-native/Libraries/Image/ImageSource";
|
|
4
|
+
import type { AppleIcon, BaseRoute, NavigationState, TabBarPlacement, TabRole } from "./types";
|
|
5
|
+
import { type RNBottomTabsAccessoryViewProps } from "./BottomAccessoryView";
|
|
6
6
|
interface Props<Route extends BaseRoute> {
|
|
7
7
|
labeled?: boolean;
|
|
8
|
+
/** Optional physical-left menu; all motion and input are owned by native. */
|
|
9
|
+
renderDrawerContent?: () => React.ReactNode;
|
|
10
|
+
/** External drawer target. Mirror onDrawerOpenChange for user transitions. */
|
|
11
|
+
drawerOpen?: boolean;
|
|
12
|
+
/** Enables root-screen content swipes after inner horizontal views reach their boundary. */
|
|
13
|
+
drawerSwipeEnabled?: boolean;
|
|
14
|
+
/** Reports a completed user target so the external open state can follow it. */
|
|
15
|
+
onDrawerOpenChange?: (open: boolean) => void;
|
|
8
16
|
/**
|
|
9
17
|
* A tab bar style that adapts to each platform.
|
|
10
18
|
*
|
|
@@ -27,11 +35,11 @@ interface Props<Route extends BaseRoute> {
|
|
|
27
35
|
/**
|
|
28
36
|
* Describes the appearance attributes for the tabBar to use when an observable scroll view is scrolled to the bottom. (iOS only)
|
|
29
37
|
*/
|
|
30
|
-
scrollEdgeAppearance?:
|
|
38
|
+
scrollEdgeAppearance?: "default" | "opaque" | "transparent";
|
|
31
39
|
/**
|
|
32
40
|
* Behavior for minimizing the tab bar. (iOS 26+)
|
|
33
41
|
*/
|
|
34
|
-
minimizeBehavior?:
|
|
42
|
+
minimizeBehavior?: "automatic" | "onScrollDown" | "onScrollUp" | "never";
|
|
35
43
|
/**
|
|
36
44
|
* Active tab color.
|
|
37
45
|
*/
|
|
@@ -178,7 +186,7 @@ interface Props<Route extends BaseRoute> {
|
|
|
178
186
|
* A function that returns a React element to display as bottom accessory view.
|
|
179
187
|
* iOS 26+ only.
|
|
180
188
|
*/
|
|
181
|
-
renderBottomAccessoryView?: RNBottomTabsAccessoryViewProps[
|
|
189
|
+
renderBottomAccessoryView?: RNBottomTabsAccessoryViewProps["renderBottomAccessoryView"];
|
|
182
190
|
/**
|
|
183
191
|
* Whether the tab bar is hidden.
|
|
184
192
|
*/
|
|
@@ -190,7 +198,7 @@ interface Props<Route extends BaseRoute> {
|
|
|
190
198
|
/**
|
|
191
199
|
* Visual style of the Android tab bar. Android only.
|
|
192
200
|
*/
|
|
193
|
-
androidTabBarStyle?:
|
|
201
|
+
androidTabBarStyle?: "default" | "floating";
|
|
194
202
|
/**
|
|
195
203
|
* Whether the tab bar ignores the soft keyboard. Defaults to true, so the
|
|
196
204
|
* keyboard covers the tab bar as on iOS. Set to false to pad the tab bar by
|
|
@@ -203,7 +211,25 @@ interface Props<Route extends BaseRoute> {
|
|
|
203
211
|
* original delayed behavior.
|
|
204
212
|
*/
|
|
205
213
|
delayedFreeze?: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Called when the system moves the tab bar between the bottom edge and a
|
|
216
|
+
* vertical bar on the leading or trailing edge (iPhone Duo). iOS only.
|
|
217
|
+
*/
|
|
218
|
+
onTabBarPlacementChange?: (placement: TabBarPlacement) => void;
|
|
219
|
+
/**
|
|
220
|
+
* Icon of a round button shown above a vertical tab bar. The button only
|
|
221
|
+
* appears while the tab bar is vertical and visible. iOS only.
|
|
222
|
+
*/
|
|
223
|
+
sideAccessoryIcon?: ImageSourcePropType;
|
|
224
|
+
/**
|
|
225
|
+
* Accessibility label of the side accessory button.
|
|
226
|
+
*/
|
|
227
|
+
sideAccessoryLabel?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Called when the side accessory button is pressed.
|
|
230
|
+
*/
|
|
231
|
+
onSideAccessoryPress?: () => void;
|
|
206
232
|
}
|
|
207
|
-
declare const BottomTabs: <Route extends BaseRoute>({ navigationState, renderScene, renderLazyPlaceholder, onIndexChange, onTabDoublePress, rippleColor, tabBarActiveTintColor: activeTintColor, tabBarInactiveTintColor: inactiveTintColor, getBadge, getBadgeBackgroundColor, getBadgeTextColor, getLazy, getLabelText, getIcon, getHidden, getActiveTintColor, getTestID, getRole, getSceneStyle, getPreventsDefault, hapticFeedbackEnabled, labeled, getFreezeOnBlur, tabBar: renderCustomTabBar, tabBarStyle, tabLabelStyle, renderBottomAccessoryView, activeIndicatorColor, androidBottomBlurEnabled, delayedFreeze, ...props }: Props<Route>) => import("react/jsx-runtime").JSX.Element;
|
|
233
|
+
declare const BottomTabs: <Route extends BaseRoute>({ navigationState, renderScene, renderLazyPlaceholder, onIndexChange, onTabDoublePress, renderDrawerContent, drawerOpen, drawerSwipeEnabled, onDrawerOpenChange, rippleColor, tabBarActiveTintColor: activeTintColor, tabBarInactiveTintColor: inactiveTintColor, getBadge, getBadgeBackgroundColor, getBadgeTextColor, getLazy, getLabelText, getIcon, getHidden, getActiveTintColor, getTestID, getRole, getSceneStyle, getPreventsDefault, hapticFeedbackEnabled, labeled, getFreezeOnBlur, tabBar: renderCustomTabBar, tabBarStyle, tabLabelStyle, renderBottomAccessoryView, activeIndicatorColor, androidBottomBlurEnabled, delayedFreeze, onTabBarPlacementChange, sideAccessoryIcon, sideAccessoryLabel, onSideAccessoryPress, ...props }: Props<Route>) => import("react/jsx-runtime").JSX.Element;
|
|
208
234
|
export default BottomTabs;
|
|
209
235
|
//# sourceMappingURL=BottomTabs.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ViewProps } from "react-native";
|
|
2
|
+
import type { DirectEventHandler, Double, WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
|
+
export interface BottomTabsDrawerNativeProps extends ViewProps {
|
|
4
|
+
enabled?: WithDefault<boolean, false>;
|
|
5
|
+
open?: WithDefault<boolean, false>;
|
|
6
|
+
swipeEnabled?: WithDefault<boolean, false>;
|
|
7
|
+
hapticFeedbackEnabled?: WithDefault<boolean, false>;
|
|
8
|
+
bottomBarHeight?: Double;
|
|
9
|
+
onDrawerOpenChange?: DirectEventHandler<Readonly<{
|
|
10
|
+
open: boolean;
|
|
11
|
+
}>>;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<BottomTabsDrawerNativeProps>;
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=BottomTabsDrawerNativeComponent.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BottomTabsDrawerNativeProps } from "./BottomTabsDrawerNativeComponent";
|
|
3
|
+
export default function BottomTabsDrawerWeb({ children, }: React.PropsWithChildren<BottomTabsDrawerNativeProps>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=BottomTabsDrawerNativeComponent.web.d.ts.map
|
|
@@ -11,6 +11,10 @@ export type OnNativeLayout = Readonly<{
|
|
|
11
11
|
width: Double;
|
|
12
12
|
height: Double;
|
|
13
13
|
}>;
|
|
14
|
+
export type OnTabBarPlacementChange = Readonly<{
|
|
15
|
+
placement: string;
|
|
16
|
+
}>;
|
|
17
|
+
export type OnSideAccessoryPress = Readonly<{}>;
|
|
14
18
|
export type BottomTabsItems = ReadonlyArray<{
|
|
15
19
|
key: string;
|
|
16
20
|
title: string;
|
|
@@ -53,6 +57,10 @@ export interface BottomTabsNativeProps extends ViewProps {
|
|
|
53
57
|
ignoreBottomInsets?: boolean;
|
|
54
58
|
androidTabBarStyle?: WithDefault<'default' | 'floating', 'default'>;
|
|
55
59
|
ignoreKeyboardInsets?: WithDefault<boolean, true>;
|
|
60
|
+
onTabBarPlacementChange?: DirectEventHandler<OnTabBarPlacementChange>;
|
|
61
|
+
sideAccessoryIcon?: ImageSource;
|
|
62
|
+
sideAccessoryLabel?: string;
|
|
63
|
+
onSideAccessoryPress?: DirectEventHandler<OnSideAccessoryPress>;
|
|
56
64
|
}
|
|
57
65
|
declare const _default: import("react-native").HostComponent<BottomTabsNativeProps>;
|
|
58
66
|
export default _default;
|
|
@@ -12,5 +12,5 @@ export { BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
|
|
|
12
12
|
/**
|
|
13
13
|
* Types
|
|
14
14
|
*/
|
|
15
|
-
export type { AppleIcon, TabRole } from './types';
|
|
15
|
+
export type { AppleIcon, TabBarPlacement, TabRole } from './types';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-bottom-tabs",
|
|
3
|
-
"version": "6.7.0-
|
|
3
|
+
"version": "6.7.0-20",
|
|
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",
|
|
@@ -107,7 +107,8 @@
|
|
|
107
107
|
"ios": {
|
|
108
108
|
"componentProvider": {
|
|
109
109
|
"RNBottomTabsView": "RCTBottomTabsComponentView",
|
|
110
|
-
"RNBottomTabsAccessoryView": "RCTBottomAccessoryComponentView"
|
|
110
|
+
"RNBottomTabsAccessoryView": "RCTBottomAccessoryComponentView",
|
|
111
|
+
"RNBottomTabsDrawer": "RCTBottomTabsDrawerComponentView"
|
|
111
112
|
},
|
|
112
113
|
"modulesConformingToProtocol": {
|
|
113
114
|
"RCTImageDataDecoder": [
|
package/react-native.config.js
CHANGED
|
@@ -2,7 +2,10 @@ module.exports = {
|
|
|
2
2
|
dependency: {
|
|
3
3
|
platforms: {
|
|
4
4
|
android: {
|
|
5
|
-
componentDescriptors: [
|
|
5
|
+
componentDescriptors: [
|
|
6
|
+
'RNBottomTabsViewComponentDescriptor',
|
|
7
|
+
'RNBottomTabsDrawerComponentDescriptor',
|
|
8
|
+
],
|
|
6
9
|
cmakeListsPath: undefined,
|
|
7
10
|
packageImportPath:
|
|
8
11
|
'import com.onekey.bottomtabs.BottomTabsPackage;',
|