@onekeyfe/react-native-bottom-tabs 6.7.0-21 → 6.7.0-23

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 (33) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/onekey/bottomtabs/BottomTabsView.kt +58 -7
  3. package/android/src/main/java/com/onekey/bottomtabs/SharedSvgDecoder.kt +51 -0
  4. package/docs/SPEC.md +59 -0
  5. package/ios/RCTBottomAccessoryContainerView.swift +2 -0
  6. package/ios/RCTBottomTabsContainerView.swift +219 -12
  7. package/ios/RCTBottomTabsDrawerContainerView.swift +19 -0
  8. package/ios/SVG/SvgDecoder.mm +7 -3
  9. package/ios/TabBarFontSize.swift +2 -0
  10. package/lib/module/BottomAccessoryViewNativeComponent.ts +10 -10
  11. package/lib/module/BottomTabs.js +83 -55
  12. package/lib/module/BottomTabsDrawerNativeComponent.ts +12 -12
  13. package/lib/module/BottomTabsNativeComponent.ts +22 -23
  14. package/lib/typescript/src/BottomAccessoryView.d.ts +1 -1
  15. package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts +6 -7
  16. package/lib/typescript/src/BottomTabs.d.ts +12 -6
  17. package/lib/typescript/src/BottomTabsDrawerNativeComponent.d.ts +8 -9
  18. package/lib/typescript/src/BottomTabsDrawerNativeComponent.web.d.ts +1 -1
  19. package/lib/typescript/src/BottomTabsNativeComponent.d.ts +15 -16
  20. package/lib/typescript/src/DelayedFreeze.d.ts +1 -1
  21. package/lib/typescript/src/SceneMap.d.ts +1 -1
  22. package/lib/typescript/src/index.d.ts +1 -1
  23. package/lib/typescript/src/types.d.ts +6 -2
  24. package/package.json +5 -4
  25. package/react-native-bottom-tabs.podspec +2 -0
  26. package/src/BottomAccessoryViewNativeComponent.ts +10 -10
  27. package/src/BottomTabs.tsx +118 -56
  28. package/src/BottomTabsDrawerNativeComponent.ts +12 -12
  29. package/src/BottomTabsNativeComponent.ts +22 -23
  30. package/src/index.tsx +7 -1
  31. package/src/types.ts +10 -2
  32. package/ios/SVG/CoreSVG.h +0 -13
  33. package/ios/SVG/CoreSVG.mm +0 -177
@@ -1,4 +1,6 @@
1
+ #if canImport(React)
1
2
  import React
3
+ #endif
2
4
  import UIKit
3
5
 
4
6
  enum TabBarFontSize {
@@ -1,13 +1,13 @@
1
- import { codegenNativeComponent } from 'react-native';
2
- import type { ViewProps } from 'react-native';
3
- import type {
4
- DirectEventHandler,
5
- Double,
6
- } from 'react-native/Libraries/Types/CodegenTypes';
1
+ import {
2
+ codegenNativeComponent,
3
+ type CodegenTypes,
4
+ type ViewProps,
5
+ } from 'react-native';
6
+
7
7
 
8
8
  export type OnNativeLayout = Readonly<{
9
- width: Double;
10
- height: Double;
9
+ width: CodegenTypes.Double;
10
+ height: CodegenTypes.Double;
11
11
  }>;
12
12
 
13
13
  export type OnPlacementChanged = Readonly<{
@@ -15,8 +15,8 @@ export type OnPlacementChanged = Readonly<{
15
15
  }>;
16
16
 
17
17
  export interface BottomAccessoryViewNativeProps extends ViewProps {
18
- onNativeLayout?: DirectEventHandler<OnNativeLayout>;
19
- onPlacementChanged?: DirectEventHandler<OnPlacementChanged>;
18
+ onNativeLayout?: CodegenTypes.DirectEventHandler<OnNativeLayout>;
19
+ onPlacementChanged?: CodegenTypes.DirectEventHandler<OnPlacementChanged>;
20
20
  }
21
21
 
22
22
  export default codegenNativeComponent<BottomAccessoryViewNativeProps>(
@@ -3,16 +3,83 @@
3
3
  import React, { useLayoutEffect, useRef } from "react";
4
4
  import { Image, Platform, StyleSheet, View, processColor } from "react-native";
5
5
  import { BottomTabBarHeightContext } from "./utils/BottomTabBarHeightContext.js";
6
-
7
- // eslint-disable-next-line @react-native/no-deep-imports
8
-
9
6
  import NativeBottomTabs from "./BottomTabsNativeComponent";
10
7
  import useLatestCallback from "use-latest-callback";
11
8
  import DelayedFreeze from "./DelayedFreeze.js";
12
9
  import NativeBottomTabsDrawer from "./BottomTabsDrawerNativeComponent";
13
10
  import { BottomAccessoryView } from "./BottomAccessoryView.js";
14
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
- const isAppleSymbol = icon => icon?.sfSymbol;
12
+ const isAppleSymbol = icon => Boolean(typeof icon === "object" && icon !== null && "sfSymbol" in icon && typeof icon.sfSymbol === "string");
13
+ const ONEKEY_ICON_URI_PREFIX = "onekey-icon://";
14
+ export const resolveTabIconSource = icon => {
15
+ if (!icon || isAppleSymbol(icon)) {
16
+ return {
17
+ uri: "",
18
+ width: 0,
19
+ height: 0,
20
+ scale: 1
21
+ };
22
+ }
23
+ if (typeof icon === "string") {
24
+ const trimmed = icon.trim();
25
+ if (!trimmed) {
26
+ return {
27
+ uri: "",
28
+ width: 0,
29
+ height: 0,
30
+ scale: 1
31
+ };
32
+ }
33
+ if (trimmed.startsWith(ONEKEY_ICON_URI_PREFIX) || /^[A-Z][A-Za-z0-9]*$/.test(trimmed)) {
34
+ const uri = trimmed.startsWith(ONEKEY_ICON_URI_PREFIX) ? trimmed : `${ONEKEY_ICON_URI_PREFIX}${trimmed}`;
35
+ return {
36
+ uri,
37
+ width: 24,
38
+ height: 24,
39
+ scale: 1
40
+ };
41
+ }
42
+ icon = {
43
+ uri: trimmed
44
+ };
45
+ }
46
+ if (typeof icon === "object" && !Array.isArray(icon) && "iconName" in icon && typeof icon.iconName === "string") {
47
+ const trimmed = icon.iconName.trim();
48
+ if (!trimmed) {
49
+ return {
50
+ uri: "",
51
+ width: 0,
52
+ height: 0,
53
+ scale: 1
54
+ };
55
+ }
56
+ return {
57
+ uri: `${ONEKEY_ICON_URI_PREFIX}${trimmed}`,
58
+ width: 24,
59
+ height: 24,
60
+ scale: 1
61
+ };
62
+ }
63
+ if (typeof icon === "object" && !Array.isArray(icon) && "uri" in icon && typeof icon.uri === "string" && icon.uri.startsWith(ONEKEY_ICON_URI_PREFIX)) {
64
+ return {
65
+ uri: icon.uri,
66
+ width: typeof icon.width === "number" && icon.width > 0 ? icon.width : 24,
67
+ height: typeof icon.height === "number" && icon.height > 0 ? icon.height : 24,
68
+ scale: typeof icon.scale === "number" && icon.scale > 0 ? icon.scale : 1
69
+ };
70
+ }
71
+ const resolved = Image.resolveAssetSource(icon);
72
+ return {
73
+ uri: resolved?.uri ?? "",
74
+ width: resolved?.width ?? 0,
75
+ height: resolved?.height ?? 0,
76
+ scale: resolved?.scale ?? 1
77
+ };
78
+ };
79
+ const defaultGetIcon = ({
80
+ route,
81
+ focused
82
+ }) => route.unfocusedIcon ? focused ? route.focusedIcon : route.unfocusedIcon : route.focusedIcon;
16
83
  const ANDROID_MAX_TABS = 100;
17
84
  const BottomTabs = ({
18
85
  navigationState,
@@ -42,10 +109,7 @@ const BottomTabs = ({
42
109
  getLabelText = ({
43
110
  route
44
111
  }) => route.title,
45
- getIcon = ({
46
- route,
47
- focused
48
- }) => route.unfocusedIcon ? focused ? route.focusedIcon : route.unfocusedIcon : route.focusedIcon,
112
+ getIcon = defaultGetIcon,
49
113
  getHidden = ({
50
114
  route
51
115
  }) => route.hidden,
@@ -88,7 +152,9 @@ const BottomTabs = ({
88
152
  const nativeBottomTabsRef = useRef(null);
89
153
  const [nativeTabBarHeight, setNativeTabBarHeight] = React.useState(0);
90
154
  const [customTabBarHeight, setCustomTabBarHeight] = React.useState(0);
91
- const tabBarHeight = renderCustomTabBar ? customTabBarHeight : props.tabBarHidden ? 0 : nativeTabBarHeight;
155
+ const [tabBarPlacement, setTabBarPlacement] = React.useState("bottom");
156
+ // A vertical bar measures its full column height but takes no bottom space.
157
+ const tabBarHeight = renderCustomTabBar ? customTabBarHeight : props.tabBarHidden || tabBarPlacement !== "bottom" ? 0 : nativeTabBarHeight;
92
158
  const [measuredDimensions, setMeasuredDimensions] = React.useState({
93
159
  width: "100%",
94
160
  height: "100%"
@@ -169,45 +235,11 @@ const BottomTabs = ({
169
235
  })
170
236
  };
171
237
  }), [trimmedRoutes, icons, getLabelText, getBadge, getBadgeBackgroundColor, getBadgeTextColor, getActiveTintColor, getHidden, getTestID, getRole, getPreventsDefault]);
172
- const resolvedIconAssets = React.useMemo(() => icons.map(icon => {
173
- if (icon && !isAppleSymbol(icon)) {
174
- // @ts-ignore - resolveAssetSource accepts ImageSourcePropType
175
- const resolved = Image.resolveAssetSource(icon);
176
- return {
177
- uri: resolved?.uri ?? "",
178
- width: resolved?.width ?? 0,
179
- height: resolved?.height ?? 0,
180
- scale: resolved?.scale ?? 1
181
- };
182
- }
183
- return {
184
- uri: "",
185
- width: 0,
186
- height: 0,
187
- scale: 1
188
- };
189
- }), [icons]);
238
+ const resolvedIconAssets = React.useMemo(() => icons.map(icon => resolveTabIconSource(icon)), [icons]);
190
239
 
191
240
  // Focused (solid) assets passed to iOS as selectedImage. iOS only — Android
192
241
  // ignores selectedIcons and keeps swapping via the focusedKey array above.
193
- const resolvedSelectedIconAssets = React.useMemo(() => focusedIcons.map(icon => {
194
- if (icon && !isAppleSymbol(icon)) {
195
- // @ts-ignore - resolveAssetSource accepts ImageSourcePropType
196
- const resolved = Image.resolveAssetSource(icon);
197
- return {
198
- uri: resolved?.uri ?? "",
199
- width: resolved?.width ?? 0,
200
- height: resolved?.height ?? 0,
201
- scale: resolved?.scale ?? 1
202
- };
203
- }
204
- return {
205
- uri: "",
206
- width: 0,
207
- height: 0,
208
- scale: 1
209
- };
210
- }), [focusedIcons]);
242
+ const resolvedSelectedIconAssets = React.useMemo(() => focusedIcons.map(icon => resolveTabIconSource(icon)), [focusedIcons]);
211
243
  const jumpTo = useLatestCallback(key => {
212
244
  const index = trimmedRoutes.findIndex(route => route.key === key);
213
245
  if (index === -1) {
@@ -249,7 +281,9 @@ const BottomTabs = ({
249
281
  });
250
282
  }, [setMeasuredDimensions]);
251
283
  const handleTabBarPlacementChange = React.useCallback(event => {
252
- onTabBarPlacementChange?.(event.nativeEvent.placement);
284
+ const placement = event.nativeEvent.placement;
285
+ setTabBarPlacement(placement);
286
+ onTabBarPlacementChange?.(placement);
253
287
  }, [onTabBarPlacementChange]);
254
288
  const handleSideAccessoryPress = React.useCallback(() => {
255
289
  onSideAccessoryPress?.();
@@ -258,15 +292,9 @@ const BottomTabs = ({
258
292
  if (!isIOS || !sideAccessoryIcon) {
259
293
  return undefined;
260
294
  }
261
- // @ts-ignore - resolveAssetSource accepts ImageSourcePropType
262
- const resolved = Image.resolveAssetSource(sideAccessoryIcon);
263
- return resolved?.uri ? {
264
- uri: resolved.uri,
265
- width: resolved.width ?? 0,
266
- height: resolved.height ?? 0,
267
- scale: resolved.scale ?? 1
268
- } : undefined;
269
- }, [sideAccessoryIcon]);
295
+ const resolved = resolveTabIconSource(sideAccessoryIcon);
296
+ return resolved.uri ? resolved : undefined;
297
+ }, [isIOS, sideAccessoryIcon]);
270
298
  useLayoutEffect(() => {
271
299
  if (renderCustomTabBar && customTabBarWrapperRef.current) {
272
300
  customTabBarWrapperRef.current.measure((_x, _y, _width, height) => {
@@ -1,17 +1,17 @@
1
- import { codegenNativeComponent, type ViewProps } from "react-native";
2
- import type {
3
- DirectEventHandler,
4
- Double,
5
- WithDefault,
6
- } from "react-native/Libraries/Types/CodegenTypes";
1
+ import {
2
+ codegenNativeComponent,
3
+ type CodegenTypes,
4
+ type ViewProps,
5
+ } from "react-native";
6
+
7
7
 
8
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 }>>;
9
+ enabled?: CodegenTypes.WithDefault<boolean, false>;
10
+ open?: CodegenTypes.WithDefault<boolean, false>;
11
+ swipeEnabled?: CodegenTypes.WithDefault<boolean, false>;
12
+ hapticFeedbackEnabled?: CodegenTypes.WithDefault<boolean, false>;
13
+ bottomBarHeight?: CodegenTypes.Double;
14
+ onDrawerOpenChange?: CodegenTypes.DirectEventHandler<Readonly<{ open: boolean }>>;
15
15
  }
16
16
 
17
17
  export default codegenNativeComponent<BottomTabsDrawerNativeProps>(
@@ -1,12 +1,11 @@
1
- import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
2
- import type { ColorValue, ProcessedColorValue, ViewProps } from 'react-native';
3
- import type {
4
- DirectEventHandler,
5
- Double,
6
- Int32,
7
- WithDefault,
8
- } from 'react-native/Libraries/Types/CodegenTypes';
9
- //@ts-ignore
1
+ import {
2
+ codegenNativeComponent,
3
+ type CodegenTypes,
4
+ type ColorValue,
5
+ type ProcessedColorValue,
6
+ type ViewProps,
7
+ } from 'react-native';
8
+ // @ts-ignore
10
9
  import type { ImageSource } from 'react-native/Libraries/Image/ImageSource';
11
10
 
12
11
  export type OnPageSelectedEventData = Readonly<{
@@ -14,12 +13,12 @@ export type OnPageSelectedEventData = Readonly<{
14
13
  }>;
15
14
 
16
15
  export type OnTabBarMeasured = Readonly<{
17
- height: Int32;
16
+ height: CodegenTypes.Int32;
18
17
  }>;
19
18
 
20
19
  export type OnNativeLayout = Readonly<{
21
- width: Double;
22
- height: Double;
20
+ width: CodegenTypes.Double;
21
+ height: CodegenTypes.Double;
23
22
  }>;
24
23
 
25
24
  // Where the system draws the tab bar: 'bottom', or 'leading' / 'trailing' for
@@ -47,10 +46,10 @@ export type BottomTabsItems = ReadonlyArray<{
47
46
  export interface BottomTabsNativeProps extends ViewProps {
48
47
  items: BottomTabsItems;
49
48
  selectedPage: string;
50
- onPageSelected?: DirectEventHandler<OnPageSelectedEventData>;
51
- onTabDoublePress?: DirectEventHandler<OnPageSelectedEventData>;
52
- onTabBarMeasured?: DirectEventHandler<OnTabBarMeasured>;
53
- onNativeLayout?: DirectEventHandler<OnNativeLayout>;
49
+ onPageSelected?: CodegenTypes.DirectEventHandler<OnPageSelectedEventData>;
50
+ onTabDoublePress?: CodegenTypes.DirectEventHandler<OnPageSelectedEventData>;
51
+ onTabBarMeasured?: CodegenTypes.DirectEventHandler<OnTabBarMeasured>;
52
+ onNativeLayout?: CodegenTypes.DirectEventHandler<OnNativeLayout>;
54
53
  icons?: ReadonlyArray<ImageSource>;
55
54
  selectedIcons?: ReadonlyArray<ImageSource>;
56
55
  tabBarHidden?: boolean;
@@ -58,8 +57,8 @@ export interface BottomTabsNativeProps extends ViewProps {
58
57
  sidebarAdaptable?: boolean;
59
58
  scrollEdgeAppearance?: string;
60
59
  barTintColor?: ColorValue;
61
- translucent?: WithDefault<boolean, true>;
62
- androidBottomBlurEnabled?: WithDefault<boolean, false>;
60
+ translucent?: CodegenTypes.WithDefault<boolean, true>;
61
+ androidBottomBlurEnabled?: CodegenTypes.WithDefault<boolean, false>;
63
62
  rippleColor?: ColorValue;
64
63
  activeTintColor?: ColorValue;
65
64
  inactiveTintColor?: ColorValue;
@@ -69,15 +68,15 @@ export interface BottomTabsNativeProps extends ViewProps {
69
68
  minimizeBehavior?: string;
70
69
  fontFamily?: string;
71
70
  fontWeight?: string;
72
- fontSize?: Int32;
71
+ fontSize?: CodegenTypes.Int32;
73
72
  ignoreBottomInsets?: boolean;
74
- androidTabBarStyle?: WithDefault<'default' | 'floating', 'default'>;
75
- ignoreKeyboardInsets?: WithDefault<boolean, true>;
76
- onTabBarPlacementChange?: DirectEventHandler<OnTabBarPlacementChange>;
73
+ androidTabBarStyle?: CodegenTypes.WithDefault<'default' | 'floating', 'default'>;
74
+ ignoreKeyboardInsets?: CodegenTypes.WithDefault<boolean, true>;
75
+ onTabBarPlacementChange?: CodegenTypes.DirectEventHandler<OnTabBarPlacementChange>;
77
76
  // A round button drawn above a vertical tab bar; iOS only.
78
77
  sideAccessoryIcon?: ImageSource;
79
78
  sideAccessoryLabel?: string;
80
- onSideAccessoryPress?: DirectEventHandler<OnSideAccessoryPress>;
79
+ onSideAccessoryPress?: CodegenTypes.DirectEventHandler<OnSideAccessoryPress>;
81
80
  }
82
81
 
83
82
  export default codegenNativeComponent<BottomTabsNativeProps>('RNBottomTabsView');
@@ -4,5 +4,5 @@ export interface RNBottomTabsAccessoryViewProps {
4
4
  placement: 'inline' | 'expanded' | 'none';
5
5
  }) => React.ReactNode;
6
6
  }
7
- export declare const BottomAccessoryView: (props: RNBottomTabsAccessoryViewProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const BottomAccessoryView: (props: RNBottomTabsAccessoryViewProps) => React.JSX.Element;
8
8
  //# sourceMappingURL=BottomAccessoryView.d.ts.map
@@ -1,16 +1,15 @@
1
- import type { ViewProps } from 'react-native';
2
- import type { DirectEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';
1
+ import { type CodegenTypes, type ViewProps } from 'react-native';
3
2
  export type OnNativeLayout = Readonly<{
4
- width: Double;
5
- height: Double;
3
+ width: CodegenTypes.Double;
4
+ height: CodegenTypes.Double;
6
5
  }>;
7
6
  export type OnPlacementChanged = Readonly<{
8
7
  placement: string;
9
8
  }>;
10
9
  export interface BottomAccessoryViewNativeProps extends ViewProps {
11
- onNativeLayout?: DirectEventHandler<OnNativeLayout>;
12
- onPlacementChanged?: DirectEventHandler<OnPlacementChanged>;
10
+ onNativeLayout?: CodegenTypes.DirectEventHandler<OnNativeLayout>;
11
+ onPlacementChanged?: CodegenTypes.DirectEventHandler<OnPlacementChanged>;
13
12
  }
14
- declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<BottomAccessoryViewNativeProps>;
13
+ declare const _default: import("react-native").HostComponent<BottomAccessoryViewNativeProps>;
15
14
  export default _default;
16
15
  //# sourceMappingURL=BottomAccessoryViewNativeComponent.d.ts.map
@@ -1,8 +1,14 @@
1
1
  import React from "react";
2
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";
3
+ import type { BaseRoute, BottomTabIconSource, NamedIcon, NavigationState, TabBarPlacement, TabRole } from "./types";
5
4
  import { type RNBottomTabsAccessoryViewProps } from "./BottomAccessoryView";
5
+ type ResolvedTabIconSource = {
6
+ uri: string;
7
+ width: number;
8
+ height: number;
9
+ scale: number;
10
+ };
11
+ export declare const resolveTabIconSource: (icon: BottomTabIconSource | undefined | null) => ResolvedTabIconSource;
6
12
  interface Props<Route extends BaseRoute> {
7
13
  labeled?: boolean;
8
14
  /** Optional physical-left menu; all motion and input are owned by native. */
@@ -120,10 +126,10 @@ interface Props<Route extends BaseRoute> {
120
126
  /**
121
127
  * Get icon for the tab.
122
128
  */
123
- getIcon?: (props: {
129
+ getIcon?: ({ route, focused, }: {
124
130
  route: Route;
125
131
  focused: boolean;
126
- }) => ImageSource | AppleIcon | undefined | null;
132
+ }) => BottomTabIconSource | undefined | null;
127
133
  /**
128
134
  * Get hidden for the tab.
129
135
  */
@@ -220,7 +226,7 @@ interface Props<Route extends BaseRoute> {
220
226
  * Icon of a round button shown above a vertical tab bar. The button only
221
227
  * appears while the tab bar is vertical and visible. iOS only.
222
228
  */
223
- sideAccessoryIcon?: ImageSourcePropType;
229
+ sideAccessoryIcon?: ImageSourcePropType | NamedIcon | string;
224
230
  /**
225
231
  * Accessibility label of the side accessory button.
226
232
  */
@@ -230,6 +236,6 @@ interface Props<Route extends BaseRoute> {
230
236
  */
231
237
  onSideAccessoryPress?: () => void;
232
238
  }
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;
239
+ 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>) => React.JSX.Element;
234
240
  export default BottomTabs;
235
241
  //# sourceMappingURL=BottomTabs.d.ts.map
@@ -1,15 +1,14 @@
1
- import { type ViewProps } from "react-native";
2
- import type { DirectEventHandler, Double, WithDefault } from "react-native/Libraries/Types/CodegenTypes";
1
+ import { type CodegenTypes, type ViewProps } from "react-native";
3
2
  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<{
3
+ enabled?: CodegenTypes.WithDefault<boolean, false>;
4
+ open?: CodegenTypes.WithDefault<boolean, false>;
5
+ swipeEnabled?: CodegenTypes.WithDefault<boolean, false>;
6
+ hapticFeedbackEnabled?: CodegenTypes.WithDefault<boolean, false>;
7
+ bottomBarHeight?: CodegenTypes.Double;
8
+ onDrawerOpenChange?: CodegenTypes.DirectEventHandler<Readonly<{
10
9
  open: boolean;
11
10
  }>>;
12
11
  }
13
- declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<BottomTabsDrawerNativeProps>;
12
+ declare const _default: import("react-native").HostComponent<BottomTabsDrawerNativeProps>;
14
13
  export default _default;
15
14
  //# sourceMappingURL=BottomTabsDrawerNativeComponent.d.ts.map
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { BottomTabsDrawerNativeProps } from "./BottomTabsDrawerNativeComponent";
3
- export default function BottomTabsDrawerWeb({ children, }: React.PropsWithChildren<BottomTabsDrawerNativeProps>): import("react/jsx-runtime").JSX.Element;
3
+ export default function BottomTabsDrawerWeb({ children, }: React.PropsWithChildren<BottomTabsDrawerNativeProps>): React.JSX.Element;
4
4
  //# sourceMappingURL=BottomTabsDrawerNativeComponent.web.d.ts.map
@@ -1,15 +1,14 @@
1
- import type { ColorValue, ProcessedColorValue, ViewProps } from 'react-native';
2
- import type { DirectEventHandler, Double, Int32, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
1
+ import { type CodegenTypes, type ColorValue, type ProcessedColorValue, type ViewProps } from 'react-native';
3
2
  import type { ImageSource } from 'react-native/Libraries/Image/ImageSource';
4
3
  export type OnPageSelectedEventData = Readonly<{
5
4
  key: string;
6
5
  }>;
7
6
  export type OnTabBarMeasured = Readonly<{
8
- height: Int32;
7
+ height: CodegenTypes.Int32;
9
8
  }>;
10
9
  export type OnNativeLayout = Readonly<{
11
- width: Double;
12
- height: Double;
10
+ width: CodegenTypes.Double;
11
+ height: CodegenTypes.Double;
13
12
  }>;
14
13
  export type OnTabBarPlacementChange = Readonly<{
15
14
  placement: string;
@@ -31,10 +30,10 @@ export type BottomTabsItems = ReadonlyArray<{
31
30
  export interface BottomTabsNativeProps extends ViewProps {
32
31
  items: BottomTabsItems;
33
32
  selectedPage: string;
34
- onPageSelected?: DirectEventHandler<OnPageSelectedEventData>;
35
- onTabDoublePress?: DirectEventHandler<OnPageSelectedEventData>;
36
- onTabBarMeasured?: DirectEventHandler<OnTabBarMeasured>;
37
- onNativeLayout?: DirectEventHandler<OnNativeLayout>;
33
+ onPageSelected?: CodegenTypes.DirectEventHandler<OnPageSelectedEventData>;
34
+ onTabDoublePress?: CodegenTypes.DirectEventHandler<OnPageSelectedEventData>;
35
+ onTabBarMeasured?: CodegenTypes.DirectEventHandler<OnTabBarMeasured>;
36
+ onNativeLayout?: CodegenTypes.DirectEventHandler<OnNativeLayout>;
38
37
  icons?: ReadonlyArray<ImageSource>;
39
38
  selectedIcons?: ReadonlyArray<ImageSource>;
40
39
  tabBarHidden?: boolean;
@@ -42,8 +41,8 @@ export interface BottomTabsNativeProps extends ViewProps {
42
41
  sidebarAdaptable?: boolean;
43
42
  scrollEdgeAppearance?: string;
44
43
  barTintColor?: ColorValue;
45
- translucent?: WithDefault<boolean, true>;
46
- androidBottomBlurEnabled?: WithDefault<boolean, false>;
44
+ translucent?: CodegenTypes.WithDefault<boolean, true>;
45
+ androidBottomBlurEnabled?: CodegenTypes.WithDefault<boolean, false>;
47
46
  rippleColor?: ColorValue;
48
47
  activeTintColor?: ColorValue;
49
48
  inactiveTintColor?: ColorValue;
@@ -53,14 +52,14 @@ export interface BottomTabsNativeProps extends ViewProps {
53
52
  minimizeBehavior?: string;
54
53
  fontFamily?: string;
55
54
  fontWeight?: string;
56
- fontSize?: Int32;
55
+ fontSize?: CodegenTypes.Int32;
57
56
  ignoreBottomInsets?: boolean;
58
- androidTabBarStyle?: WithDefault<'default' | 'floating', 'default'>;
59
- ignoreKeyboardInsets?: WithDefault<boolean, true>;
60
- onTabBarPlacementChange?: DirectEventHandler<OnTabBarPlacementChange>;
57
+ androidTabBarStyle?: CodegenTypes.WithDefault<'default' | 'floating', 'default'>;
58
+ ignoreKeyboardInsets?: CodegenTypes.WithDefault<boolean, true>;
59
+ onTabBarPlacementChange?: CodegenTypes.DirectEventHandler<OnTabBarPlacementChange>;
61
60
  sideAccessoryIcon?: ImageSource;
62
61
  sideAccessoryLabel?: string;
63
- onSideAccessoryPress?: DirectEventHandler<OnSideAccessoryPress>;
62
+ onSideAccessoryPress?: CodegenTypes.DirectEventHandler<OnSideAccessoryPress>;
64
63
  }
65
64
  declare const _default: import("react-native").HostComponent<BottomTabsNativeProps>;
66
65
  export default _default;
@@ -4,6 +4,6 @@ interface FreezeWrapperProps {
4
4
  delayedFreeze?: boolean;
5
5
  children: React.ReactNode;
6
6
  }
7
- declare function DelayedFreeze({ freeze, delayedFreeze, children }: FreezeWrapperProps): import("react/jsx-runtime").JSX.Element;
7
+ declare function DelayedFreeze({ freeze, delayedFreeze, children }: FreezeWrapperProps): React.JSX.Element;
8
8
  export default DelayedFreeze;
9
9
  //# sourceMappingURL=DelayedFreeze.d.ts.map
@@ -5,6 +5,6 @@ type SceneProps = {
5
5
  };
6
6
  export declare function SceneMap<T>(scenes: {
7
7
  [key: string]: React.ComponentType<T>;
8
- }): ({ route, jumpTo }: SceneProps) => import("react/jsx-runtime").JSX.Element | null;
8
+ }): ({ route, jumpTo }: SceneProps) => React.JSX.Element | null;
9
9
  export {};
10
10
  //# sourceMappingURL=SceneMap.d.ts.map
@@ -12,5 +12,5 @@ export { BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
12
12
  /**
13
13
  * Types
14
14
  */
15
- export type { AppleIcon, TabBarPlacement, TabRole } from './types';
15
+ export type { AppleIcon, BottomTabIconSource, NamedIcon, TabBarPlacement, TabRole, } from './types';
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -4,6 +4,10 @@ export type IconSource = string | ImageSourcePropType;
4
4
  export type AppleIcon = {
5
5
  sfSymbol: SFSymbol;
6
6
  };
7
+ export type NamedIcon = {
8
+ iconName: string;
9
+ };
10
+ export type BottomTabIconSource = ImageSourcePropType | AppleIcon | NamedIcon | string;
7
11
  export type TabRole = 'search';
8
12
  export type TabBarPlacement = 'bottom' | 'leading' | 'trailing';
9
13
  export type BaseRoute = {
@@ -13,8 +17,8 @@ export type BaseRoute = {
13
17
  badgeBackgroundColor?: string;
14
18
  badgeTextColor?: string;
15
19
  lazy?: boolean;
16
- focusedIcon?: ImageSourcePropType | AppleIcon;
17
- unfocusedIcon?: ImageSourcePropType | AppleIcon;
20
+ focusedIcon?: BottomTabIconSource;
21
+ unfocusedIcon?: BottomTabIconSource;
18
22
  activeTintColor?: string;
19
23
  hidden?: boolean;
20
24
  testID?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-bottom-tabs",
3
- "version": "6.7.0-21",
3
+ "version": "6.7.0-23",
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",
@@ -64,13 +64,14 @@
64
64
  "access": "public"
65
65
  },
66
66
  "devDependencies": {
67
- "@types/react": "^19.2.0",
68
- "react": "19.2.3",
69
- "react-native": "patch:react-native@npm%3A0.86.2#~/.yarn/patches/react-native-npm-0.86.2-c9d546616f.patch",
67
+ "@types/react": "^19.3.0",
68
+ "react": "19.3.0",
69
+ "react-native": "patch:react-native@npm%3A0.88.0#~/.yarn/patches/react-native-npm-0.88.0-60c6201dd2.patch",
70
70
  "react-native-builder-bob": "^0.40.13",
71
71
  "typescript": "^5.9.2"
72
72
  },
73
73
  "peerDependencies": {
74
+ "@onekeyfe/react-native-image": "6.7.0-23",
74
75
  "react": "*",
75
76
  "react-native": "*"
76
77
  },
@@ -32,5 +32,7 @@ Pod::Spec.new do |s|
32
32
  'DEFINES_MODULE' => 'YES'
33
33
  }
34
34
 
35
+ s.dependency "OneKeyImage", package["peerDependencies"]["@onekeyfe/react-native-image"]
36
+
35
37
  install_modules_dependencies(s)
36
38
  end
@@ -1,13 +1,13 @@
1
- import { codegenNativeComponent } from 'react-native';
2
- import type { ViewProps } from 'react-native';
3
- import type {
4
- DirectEventHandler,
5
- Double,
6
- } from 'react-native/Libraries/Types/CodegenTypes';
1
+ import {
2
+ codegenNativeComponent,
3
+ type CodegenTypes,
4
+ type ViewProps,
5
+ } from 'react-native';
6
+
7
7
 
8
8
  export type OnNativeLayout = Readonly<{
9
- width: Double;
10
- height: Double;
9
+ width: CodegenTypes.Double;
10
+ height: CodegenTypes.Double;
11
11
  }>;
12
12
 
13
13
  export type OnPlacementChanged = Readonly<{
@@ -15,8 +15,8 @@ export type OnPlacementChanged = Readonly<{
15
15
  }>;
16
16
 
17
17
  export interface BottomAccessoryViewNativeProps extends ViewProps {
18
- onNativeLayout?: DirectEventHandler<OnNativeLayout>;
19
- onPlacementChanged?: DirectEventHandler<OnPlacementChanged>;
18
+ onNativeLayout?: CodegenTypes.DirectEventHandler<OnNativeLayout>;
19
+ onPlacementChanged?: CodegenTypes.DirectEventHandler<OnPlacementChanged>;
20
20
  }
21
21
 
22
22
  export default codegenNativeComponent<BottomAccessoryViewNativeProps>(