@onekeyfe/react-native-tab-view 1.1.31

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 (94) hide show
  1. package/android/build.gradle +119 -0
  2. package/android/gradle.properties +4 -0
  3. package/android/src/main/AndroidManifest.xml +3 -0
  4. package/android/src/main/AndroidManifestNew.xml +2 -0
  5. package/android/src/main/java/com/rcttabview/ImageSource.kt +86 -0
  6. package/android/src/main/java/com/rcttabview/RCTTabView.kt +529 -0
  7. package/android/src/main/java/com/rcttabview/RCTTabViewManager.kt +204 -0
  8. package/android/src/main/java/com/rcttabview/RCTTabViewPackage.kt +16 -0
  9. package/android/src/main/java/com/rcttabview/TabInfo.kt +12 -0
  10. package/android/src/main/java/com/rcttabview/Utils.kt +31 -0
  11. package/android/src/main/java/com/rcttabview/events/OnNativeLayoutEvent.kt +20 -0
  12. package/android/src/main/java/com/rcttabview/events/OnTabBarMeasuredEvent.kt +19 -0
  13. package/android/src/main/java/com/rcttabview/events/PageSelectedEvent.kt +21 -0
  14. package/android/src/main/java/com/rcttabview/events/TabLongPressedEvent.kt +19 -0
  15. package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewComponentDescriptor.h +32 -0
  16. package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewShadowNode.cpp +18 -0
  17. package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewShadowNode.h +35 -0
  18. package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewState.cpp +15 -0
  19. package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewState.h +25 -0
  20. package/ios/Extensions.swift +46 -0
  21. package/ios/RCTBottomAccessoryComponentView.h +12 -0
  22. package/ios/RCTBottomAccessoryComponentView.mm +67 -0
  23. package/ios/RCTBottomAccessoryContainerView.swift +51 -0
  24. package/ios/RCTTabViewComponentView.h +12 -0
  25. package/ios/RCTTabViewComponentView.mm +325 -0
  26. package/ios/RCTTabViewContainerView.swift +768 -0
  27. package/ios/RCTTabViewLog.h +7 -0
  28. package/ios/RCTTabViewLog.m +32 -0
  29. package/ios/SVG/CoreSVG.h +13 -0
  30. package/ios/SVG/CoreSVG.mm +177 -0
  31. package/ios/SVG/SvgDecoder.h +10 -0
  32. package/ios/SVG/SvgDecoder.mm +32 -0
  33. package/ios/TabBarFontSize.swift +55 -0
  34. package/lib/module/BottomAccessoryView.js +45 -0
  35. package/lib/module/BottomAccessoryView.js.map +1 -0
  36. package/lib/module/BottomAccessoryViewNativeComponent.ts +27 -0
  37. package/lib/module/DelayedFreeze.js +26 -0
  38. package/lib/module/DelayedFreeze.js.map +1 -0
  39. package/lib/module/NativeSVGDecoder.js +5 -0
  40. package/lib/module/NativeSVGDecoder.js.map +1 -0
  41. package/lib/module/SceneMap.js +28 -0
  42. package/lib/module/SceneMap.js.map +1 -0
  43. package/lib/module/TabView.js +263 -0
  44. package/lib/module/TabView.js.map +1 -0
  45. package/lib/module/TabViewNativeComponent.ts +68 -0
  46. package/lib/module/codegen-types.d.js +2 -0
  47. package/lib/module/codegen-types.d.js.map +1 -0
  48. package/lib/module/index.js +20 -0
  49. package/lib/module/index.js.map +1 -0
  50. package/lib/module/package.json +1 -0
  51. package/lib/module/types.js +4 -0
  52. package/lib/module/types.js.map +1 -0
  53. package/lib/module/utils/BottomTabBarHeightContext.js +5 -0
  54. package/lib/module/utils/BottomTabBarHeightContext.js.map +1 -0
  55. package/lib/module/utils/useBottomTabBarHeight.js +12 -0
  56. package/lib/module/utils/useBottomTabBarHeight.js.map +1 -0
  57. package/lib/typescript/package.json +1 -0
  58. package/lib/typescript/src/BottomAccessoryView.d.ts +8 -0
  59. package/lib/typescript/src/BottomAccessoryView.d.ts.map +1 -0
  60. package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts +16 -0
  61. package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts.map +1 -0
  62. package/lib/typescript/src/DelayedFreeze.d.ts +8 -0
  63. package/lib/typescript/src/DelayedFreeze.d.ts.map +1 -0
  64. package/lib/typescript/src/NativeSVGDecoder.d.ts +6 -0
  65. package/lib/typescript/src/NativeSVGDecoder.d.ts.map +1 -0
  66. package/lib/typescript/src/SceneMap.d.ts +10 -0
  67. package/lib/typescript/src/SceneMap.d.ts.map +1 -0
  68. package/lib/typescript/src/TabView.d.ts +178 -0
  69. package/lib/typescript/src/TabView.d.ts.map +1 -0
  70. package/lib/typescript/src/TabViewNativeComponent.d.ts +55 -0
  71. package/lib/typescript/src/TabViewNativeComponent.d.ts.map +1 -0
  72. package/lib/typescript/src/index.d.ts +16 -0
  73. package/lib/typescript/src/index.d.ts.map +1 -0
  74. package/lib/typescript/src/types.d.ts +29 -0
  75. package/lib/typescript/src/types.d.ts.map +1 -0
  76. package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts +3 -0
  77. package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts.map +1 -0
  78. package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts +2 -0
  79. package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts.map +1 -0
  80. package/package.json +114 -0
  81. package/react-native-tab-view.podspec +36 -0
  82. package/react-native.config.js +13 -0
  83. package/src/BottomAccessoryView.tsx +58 -0
  84. package/src/BottomAccessoryViewNativeComponent.ts +27 -0
  85. package/src/DelayedFreeze.tsx +27 -0
  86. package/src/NativeSVGDecoder.ts +5 -0
  87. package/src/SceneMap.tsx +34 -0
  88. package/src/TabView.tsx +466 -0
  89. package/src/TabViewNativeComponent.ts +68 -0
  90. package/src/codegen-types.d.ts +28 -0
  91. package/src/index.tsx +18 -0
  92. package/src/types.ts +31 -0
  93. package/src/utils/BottomTabBarHeightContext.ts +5 -0
  94. package/src/utils/useBottomTabBarHeight.ts +15 -0
@@ -0,0 +1,178 @@
1
+ import React from 'react';
2
+ import { type ColorValue, type StyleProp, type ViewStyle } from 'react-native';
3
+ import type { ImageSource } from 'react-native/Libraries/Image/ImageSource';
4
+ import type { AppleIcon, BaseRoute, NavigationState, TabRole } from './types';
5
+ import { type BottomAccessoryViewProps } from './BottomAccessoryView';
6
+ interface Props<Route extends BaseRoute> {
7
+ labeled?: boolean;
8
+ /**
9
+ * A tab bar style that adapts to each platform.
10
+ *
11
+ * Tab views using the sidebar adaptable style have an appearance
12
+ * that varies depending on the platform:
13
+ * - iPadOS displays a top tab bar that can adapt into a sidebar.
14
+ * - iOS displays a bottom tab bar.
15
+ * - macOS and tvOS always show a sidebar.
16
+ * - visionOS shows an ornament and also shows a sidebar for secondary tabs within a `TabSection`.
17
+ */
18
+ sidebarAdaptable?: boolean;
19
+ /**
20
+ * Whether to disable page animations between tabs. (iOS only) Defaults to `false`.
21
+ */
22
+ disablePageAnimations?: boolean;
23
+ /**
24
+ * Whether to enable haptic feedback. Defaults to `false`.
25
+ */
26
+ hapticFeedbackEnabled?: boolean;
27
+ /**
28
+ * Describes the appearance attributes for the tabBar to use when an observable scroll view is scrolled to the bottom. (iOS only)
29
+ */
30
+ scrollEdgeAppearance?: 'default' | 'opaque' | 'transparent';
31
+ /**
32
+ * Behavior for minimizing the tab bar. (iOS 26+)
33
+ */
34
+ minimizeBehavior?: 'automatic' | 'onScrollDown' | 'onScrollUp' | 'never';
35
+ /**
36
+ * Active tab color.
37
+ */
38
+ tabBarActiveTintColor?: ColorValue;
39
+ /**
40
+ * Inactive tab color.
41
+ */
42
+ tabBarInactiveTintColor?: ColorValue;
43
+ /**
44
+ * State for the tab view.
45
+ */
46
+ navigationState: NavigationState<Route>;
47
+ /**
48
+ * Function which takes an object with the route and returns a React element.
49
+ */
50
+ renderScene: (props: {
51
+ route: Route;
52
+ jumpTo: (key: string) => void;
53
+ }) => React.ReactNode | null;
54
+ /**
55
+ * Callback which is called on tab change, receives the index of the new tab as argument.
56
+ */
57
+ onIndexChange: (index: number) => void;
58
+ /**
59
+ * Callback which is called on long press on tab, receives the index of the tab as argument.
60
+ */
61
+ onTabLongPress?: (index: number) => void;
62
+ /**
63
+ * Get lazy for the current screen. Uses true by default.
64
+ */
65
+ getLazy?: (props: {
66
+ route: Route;
67
+ }) => boolean | undefined;
68
+ /**
69
+ * Get label text for the tab, uses `route.title` by default.
70
+ */
71
+ getLabelText?: (props: {
72
+ route: Route;
73
+ }) => string | undefined;
74
+ /**
75
+ * Get badge for the tab, uses `route.badge` by default.
76
+ */
77
+ getBadge?: (props: {
78
+ route: Route;
79
+ }) => string | undefined;
80
+ /**
81
+ * Get badge background color for the tab. (Android only)
82
+ */
83
+ getBadgeBackgroundColor?: (props: {
84
+ route: Route;
85
+ }) => ColorValue | undefined;
86
+ /**
87
+ * Get badge text color for the tab. (Android only)
88
+ */
89
+ getBadgeTextColor?: (props: {
90
+ route: Route;
91
+ }) => ColorValue | undefined;
92
+ /**
93
+ * Get active tint color for the tab.
94
+ */
95
+ getActiveTintColor?: (props: {
96
+ route: Route;
97
+ }) => ColorValue | undefined;
98
+ /**
99
+ * Determines whether the tab prevents default action on press.
100
+ */
101
+ getPreventsDefault?: (props: {
102
+ route: Route;
103
+ }) => boolean | undefined;
104
+ /**
105
+ * Get icon for the tab.
106
+ */
107
+ getIcon?: (props: {
108
+ route: Route;
109
+ focused: boolean;
110
+ }) => ImageSource | AppleIcon | undefined | null;
111
+ /**
112
+ * Get hidden for the tab.
113
+ */
114
+ getHidden?: (props: {
115
+ route: Route;
116
+ }) => boolean | undefined;
117
+ /**
118
+ * Get testID for the tab.
119
+ */
120
+ getTestID?: (props: {
121
+ route: Route;
122
+ }) => string | undefined;
123
+ /**
124
+ * Get role for the tab. (iOS only)
125
+ */
126
+ getRole?: (props: {
127
+ route: Route;
128
+ }) => TabRole | undefined;
129
+ /**
130
+ * Custom tab bar to render.
131
+ */
132
+ tabBar?: () => React.ReactNode;
133
+ /**
134
+ * Get freezeOnBlur for the current screen.
135
+ */
136
+ getFreezeOnBlur?: (props: {
137
+ route: Route;
138
+ }) => boolean | undefined;
139
+ /**
140
+ * Get style for the scene.
141
+ */
142
+ getSceneStyle?: (props: {
143
+ route: Route;
144
+ }) => StyleProp<ViewStyle>;
145
+ tabBarStyle?: {
146
+ backgroundColor?: ColorValue;
147
+ };
148
+ /**
149
+ * A Boolean value that indicates whether the tab bar is translucent. (iOS only)
150
+ */
151
+ translucent?: boolean;
152
+ rippleColor?: ColorValue;
153
+ /**
154
+ * Color of tab indicator. (Android only)
155
+ */
156
+ activeIndicatorColor?: ColorValue;
157
+ tabLabelStyle?: {
158
+ fontFamily?: string;
159
+ fontWeight?: string;
160
+ fontSize?: number;
161
+ };
162
+ /**
163
+ * A function that returns a React element to display as bottom accessory view.
164
+ * iOS 26+ only.
165
+ */
166
+ renderBottomAccessoryView?: BottomAccessoryViewProps['renderBottomAccessoryView'];
167
+ /**
168
+ * Whether the tab bar is hidden.
169
+ */
170
+ tabBarHidden?: boolean;
171
+ /**
172
+ * Whether to ignore bottom system insets (navigation bar). Android only.
173
+ */
174
+ ignoreBottomInsets?: boolean;
175
+ }
176
+ declare const TabView: <Route extends BaseRoute>({ navigationState, renderScene, onIndexChange, onTabLongPress, 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, ...props }: Props<Route>) => import("react/jsx-runtime").JSX.Element;
177
+ export default TabView;
178
+ //# sourceMappingURL=TabView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../src/TabView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AAEvD,OAAO,EACL,KAAK,UAAU,EAIf,KAAK,SAAS,EAGd,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAK5E,O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AAM,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IAE/B;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,KAAK,OAAO,GAAG,SAAS,CAAC;IAEnE;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,KAAK,SAAS,CAAC,SAAS,CAAC,CAAC;IAElE,WAAW,CAAC,EAAE;QACZ,eAAe,CAAC,EAAE,UAAU,CAAC;KAC9B,CAAC;IAEF;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB;;OAEG;IACH,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,aAAa,CAAC,EAAE;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF;;;OAGG;IACH,yBAAyB,CAAC,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;IAClF;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAID,QAAA,MAAM,OAAO,GAAI,KAAK,SAAS,SAAS,EAAE,kfAmCvC,KAAK,CAAC,KAAK,CAAC,4CAiOd,CAAC;AAaF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,55 @@
1
+ import type { ColorValue, ProcessedColorValue, ViewProps } from 'react-native';
2
+ import type { DirectEventHandler, Double, Int32, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import type { ImageSource } from 'react-native/Libraries/Image/ImageSource';
4
+ export type OnPageSelectedEventData = Readonly<{
5
+ key: string;
6
+ }>;
7
+ export type OnTabBarMeasured = Readonly<{
8
+ height: Int32;
9
+ }>;
10
+ export type OnNativeLayout = Readonly<{
11
+ width: Double;
12
+ height: Double;
13
+ }>;
14
+ export type TabViewItems = ReadonlyArray<{
15
+ key: string;
16
+ title: string;
17
+ sfSymbol?: string;
18
+ badge?: string;
19
+ badgeBackgroundColor?: ProcessedColorValue | null;
20
+ badgeTextColor?: ProcessedColorValue | null;
21
+ activeTintColor?: ProcessedColorValue | null;
22
+ hidden?: boolean;
23
+ testID?: string;
24
+ role?: string;
25
+ preventsDefault?: boolean;
26
+ }>;
27
+ export interface TabViewProps extends ViewProps {
28
+ items: TabViewItems;
29
+ selectedPage: string;
30
+ onPageSelected?: DirectEventHandler<OnPageSelectedEventData>;
31
+ onTabLongPress?: DirectEventHandler<OnPageSelectedEventData>;
32
+ onTabBarMeasured?: DirectEventHandler<OnTabBarMeasured>;
33
+ onNativeLayout?: DirectEventHandler<OnNativeLayout>;
34
+ icons?: ReadonlyArray<ImageSource>;
35
+ tabBarHidden?: boolean;
36
+ labeled?: boolean;
37
+ sidebarAdaptable?: boolean;
38
+ scrollEdgeAppearance?: string;
39
+ barTintColor?: ColorValue;
40
+ translucent?: WithDefault<boolean, true>;
41
+ rippleColor?: ColorValue;
42
+ activeTintColor?: ColorValue;
43
+ inactiveTintColor?: ColorValue;
44
+ disablePageAnimations?: boolean;
45
+ activeIndicatorColor?: ColorValue;
46
+ hapticFeedbackEnabled?: boolean;
47
+ minimizeBehavior?: string;
48
+ fontFamily?: string;
49
+ fontWeight?: string;
50
+ fontSize?: Int32;
51
+ ignoreBottomInsets?: boolean;
52
+ }
53
+ declare const _default: import("react-native").HostComponent<TabViewProps>;
54
+ export default _default;
55
+ //# sourceMappingURL=TabViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/TabViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E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AAc,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;;AAED,wBAEG"}
@@ -0,0 +1,16 @@
1
+ import TabView from './TabView';
2
+ /**
3
+ * Views
4
+ */
5
+ export default TabView;
6
+ /**
7
+ * Utilities
8
+ */
9
+ export { SceneMap } from './SceneMap';
10
+ export { useBottomTabBarHeight } from './utils/useBottomTabBarHeight';
11
+ export { BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
12
+ /**
13
+ * Types
14
+ */
15
+ export type { AppleIcon, TabRole } from './types';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC;;GAEG;AACH,eAAe,OAAO,CAAC;AAEvB;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;GAEG;AACH,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';
2
+ import type { SFSymbol } from 'sf-symbols-typescript';
3
+ export type IconSource = string | ImageSourcePropType;
4
+ export type AppleIcon = {
5
+ sfSymbol: SFSymbol;
6
+ };
7
+ export type TabRole = 'search';
8
+ export type BaseRoute = {
9
+ key: string;
10
+ title?: string;
11
+ badge?: string;
12
+ badgeBackgroundColor?: string;
13
+ badgeTextColor?: string;
14
+ lazy?: boolean;
15
+ focusedIcon?: ImageSourcePropType | AppleIcon;
16
+ unfocusedIcon?: ImageSourcePropType | AppleIcon;
17
+ activeTintColor?: string;
18
+ hidden?: boolean;
19
+ testID?: string;
20
+ role?: TabRole;
21
+ freezeOnBlur?: boolean;
22
+ style?: StyleProp<ViewStyle>;
23
+ preventsDefault?: boolean;
24
+ };
25
+ export type NavigationState<Route extends BaseRoute> = {
26
+ index: number;
27
+ routes: Route[];
28
+ };
29
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,mBAAmB,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE/C,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC;AAE/B,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC9C,aAAa,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,SAAS,IAAI;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ export declare const BottomTabBarHeightContext: React.Context<number | undefined>;
3
+ //# sourceMappingURL=BottomTabBarHeightContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomTabBarHeightContext.d.ts","sourceRoot":"","sources":["../../../../src/utils/BottomTabBarHeightContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,yBAAyB,mCAE1B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function useBottomTabBarHeight(): number;
2
+ //# sourceMappingURL=useBottomTabBarHeight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBottomTabBarHeight.d.ts","sourceRoot":"","sources":["../../../../src/utils/useBottomTabBarHeight.ts"],"names":[],"mappings":"AAIA,wBAAgB,qBAAqB,WAUpC"}
package/package.json ADDED
@@ -0,0 +1,114 @@
1
+ {
2
+ "name": "@onekeyfe/react-native-tab-view",
3
+ "version": "1.1.31",
4
+ "description": "Native Bottom Tabs for React Native (UIKit implementation)",
5
+ "source": "./src/index.tsx",
6
+ "main": "./lib/module/index.js",
7
+ "types": "./lib/typescript/src/index.d.ts",
8
+ "sideEffects": false,
9
+ "exports": {
10
+ ".": {
11
+ "source": "./src/index.tsx",
12
+ "types": "./lib/typescript/src/index.d.ts",
13
+ "default": "./lib/module/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "files": [
18
+ "src",
19
+ "lib",
20
+ "android",
21
+ "ios",
22
+ "common",
23
+ "react-native.config.js",
24
+ "*.podspec",
25
+ "!ios/build",
26
+ "!android/build",
27
+ "!android/gradle",
28
+ "!android/gradlew",
29
+ "!android/gradlew.bat",
30
+ "!android/local.properties",
31
+ "!**/__tests__",
32
+ "!**/__fixtures__",
33
+ "!**/__mocks__",
34
+ "!**/.*"
35
+ ],
36
+ "scripts": {
37
+ "clean": "del-cli lib",
38
+ "prepare": "rm -rf lib && bob build",
39
+ "typecheck": "tsc -b",
40
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
41
+ "test": "jest",
42
+ "release": "yarn prepare && npm whoami && npm publish --access public"
43
+ },
44
+ "keywords": [
45
+ "react-native",
46
+ "ios",
47
+ "android"
48
+ ],
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/nicholasxuu/app-modules.git",
52
+ "directory": "native-views/react-native-tab-view"
53
+ },
54
+ "author": "OneKey",
55
+ "homepage": "https://github.com/nicholasxuu/app-modules#readme",
56
+ "license": "MIT",
57
+ "publishConfig": {
58
+ "registry": "https://registry.npmjs.org/",
59
+ "access": "public"
60
+ },
61
+ "devDependencies": {
62
+ "@types/react": "^19.2.0",
63
+ "react": "19.2.0",
64
+ "react-native": "0.83.0",
65
+ "react-native-builder-bob": "^0.40.13",
66
+ "typescript": "^5.9.2"
67
+ },
68
+ "peerDependencies": {
69
+ "react": "*",
70
+ "react-native": "*"
71
+ },
72
+ "react-native-builder-bob": {
73
+ "source": "src",
74
+ "output": "lib",
75
+ "targets": [
76
+ [
77
+ "module",
78
+ {
79
+ "esm": true
80
+ }
81
+ ],
82
+ [
83
+ "typescript",
84
+ {
85
+ "project": "tsconfig.build.json"
86
+ }
87
+ ]
88
+ ]
89
+ },
90
+ "dependencies": {
91
+ "react-freeze": "^1.0.0",
92
+ "sf-symbols-typescript": "^2.0.0",
93
+ "use-latest-callback": "^0.2.1"
94
+ },
95
+ "codegenConfig": {
96
+ "name": "RNCTabView",
97
+ "type": "all",
98
+ "jsSrcsDir": "./src",
99
+ "android": {
100
+ "javaPackageName": "com.rcttabview"
101
+ },
102
+ "ios": {
103
+ "componentProvider": {
104
+ "RNCTabView": "RCTTabViewComponentView",
105
+ "BottomAccessoryView": "RCTBottomAccessoryComponentView"
106
+ },
107
+ "modulesConformingToProtocol": {
108
+ "RCTImageDataDecoder": [
109
+ "SvgDecoder"
110
+ ]
111
+ }
112
+ }
113
+ }
114
+ }
@@ -0,0 +1,36 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "react-native-tab-view"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.ios.deployment_target = "15.1"
14
+ s.module_name = "TabViewModule"
15
+
16
+ s.source = { :git => "https://github.com/nicholasxuu/app-modules.git", :tag => "#{s.version}" }
17
+
18
+ s.source_files = [
19
+ "ios/**/*.{swift}",
20
+ "ios/**/*.{h,m,mm,cpp}",
21
+ ]
22
+
23
+ s.static_framework = true
24
+
25
+ s.subspec "common" do |ss|
26
+ ss.source_files = "common/cpp/**/*.{cpp,h}"
27
+ ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/common/cpp\"" }
28
+ end
29
+
30
+ s.pod_target_xcconfig = {
31
+ 'PRODUCT_MODULE_NAME' => 'TabViewModule',
32
+ 'DEFINES_MODULE' => 'YES'
33
+ }
34
+
35
+ install_modules_dependencies(s)
36
+ end
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ componentDescriptors: ['RNCTabViewComponentDescriptor'],
6
+ cmakeListsPath: undefined,
7
+ packageImportPath:
8
+ 'import com.rcttabview.RCTTabViewPackage;',
9
+ packageInstance: 'new RCTTabViewPackage()',
10
+ },
11
+ },
12
+ },
13
+ };
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import type { DimensionValue, NativeSyntheticEvent, ViewStyle } from 'react-native';
3
+ import BottomAccessoryViewNativeComponent from './BottomAccessoryViewNativeComponent';
4
+
5
+ const defaultStyle: ViewStyle = {
6
+ position: 'absolute',
7
+ top: 0,
8
+ left: 0,
9
+ };
10
+
11
+ export interface BottomAccessoryViewProps {
12
+ renderBottomAccessoryView: (props: {
13
+ placement: 'inline' | 'expanded' | 'none';
14
+ }) => React.ReactNode;
15
+ }
16
+
17
+ export const BottomAccessoryView = (props: BottomAccessoryViewProps) => {
18
+ const { renderBottomAccessoryView } = props;
19
+ const [bottomAccessoryDimensions, setBottomAccessoryDimensions] =
20
+ React.useState<
21
+ { width: DimensionValue; height: DimensionValue } | undefined
22
+ >({ width: '100%', height: '100%' });
23
+ const [placement, setPlacement] = React.useState<
24
+ 'inline' | 'expanded' | 'none'
25
+ >('none');
26
+
27
+ const handleNativeLayout = React.useCallback(
28
+ (event: NativeSyntheticEvent<{ width: number; height: number }>) => {
29
+ const { width, height } = event.nativeEvent;
30
+ setBottomAccessoryDimensions({ width, height });
31
+ },
32
+ [setBottomAccessoryDimensions]
33
+ );
34
+
35
+ const handlePlacementChanged = React.useCallback(
36
+ (event: NativeSyntheticEvent<{ placement: string }>) => {
37
+ const newPlacement = event.nativeEvent.placement;
38
+ if (
39
+ newPlacement === 'inline' ||
40
+ newPlacement === 'expanded' ||
41
+ newPlacement === 'none'
42
+ ) {
43
+ setPlacement(newPlacement);
44
+ }
45
+ },
46
+ [setPlacement]
47
+ );
48
+
49
+ return (
50
+ <BottomAccessoryViewNativeComponent
51
+ style={[defaultStyle, bottomAccessoryDimensions]}
52
+ onNativeLayout={handleNativeLayout}
53
+ onPlacementChanged={handlePlacementChanged}
54
+ >
55
+ {renderBottomAccessoryView({ placement })}
56
+ </BottomAccessoryViewNativeComponent>
57
+ );
58
+ };
@@ -0,0 +1,27 @@
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';
7
+
8
+ export type OnNativeLayout = Readonly<{
9
+ width: Double;
10
+ height: Double;
11
+ }>;
12
+
13
+ export type OnPlacementChanged = Readonly<{
14
+ placement: string;
15
+ }>;
16
+
17
+ export interface BottomAccessoryViewNativeProps extends ViewProps {
18
+ onNativeLayout?: DirectEventHandler<OnNativeLayout>;
19
+ onPlacementChanged?: DirectEventHandler<OnPlacementChanged>;
20
+ }
21
+
22
+ export default codegenNativeComponent<BottomAccessoryViewNativeProps>(
23
+ 'BottomAccessoryView',
24
+ {
25
+ excludedPlatforms: ['android'],
26
+ }
27
+ );
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { Freeze } from 'react-freeze';
3
+
4
+ interface FreezeWrapperProps {
5
+ freeze: boolean;
6
+ children: React.ReactNode;
7
+ }
8
+
9
+ const ANIMATION_DELAY = 200;
10
+
11
+ function DelayedFreeze({ freeze, children }: FreezeWrapperProps) {
12
+ const [freezeState, setFreezeState] = React.useState(false);
13
+
14
+ React.useEffect(() => {
15
+ const id = setTimeout(() => {
16
+ setFreezeState(freeze);
17
+ }, ANIMATION_DELAY);
18
+
19
+ return () => {
20
+ clearTimeout(id);
21
+ };
22
+ }, [freeze]);
23
+
24
+ return <Freeze freeze={freeze ? freezeState : false}>{children}</Freeze>;
25
+ }
26
+
27
+ export default DelayedFreeze;
@@ -0,0 +1,5 @@
1
+ import { TurboModuleRegistry, type TurboModule } from 'react-native';
2
+
3
+ export interface Spec extends TurboModule {}
4
+
5
+ export default TurboModuleRegistry.getEnforcing<Spec>('SvgDecoder');
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+
3
+ type SceneProps = {
4
+ route: any;
5
+ jumpTo: (key: string) => void;
6
+ };
7
+
8
+ const SceneComponent = React.memo(
9
+ <T extends { component: React.ComponentType<any> } & SceneProps>({
10
+ component,
11
+ ...rest
12
+ }: T) => {
13
+ return React.createElement(component, rest);
14
+ }
15
+ );
16
+
17
+ SceneComponent.displayName = 'SceneComponent';
18
+
19
+ export function SceneMap<T>(scenes: { [key: string]: React.ComponentType<T> }) {
20
+ return ({ route, jumpTo }: SceneProps) => {
21
+ const component = scenes[route.key];
22
+ if (!component) {
23
+ return null;
24
+ }
25
+ return (
26
+ <SceneComponent
27
+ key={route.key}
28
+ jumpTo={jumpTo}
29
+ component={component}
30
+ route={route}
31
+ />
32
+ );
33
+ };
34
+ }