@react-navigation/material-top-tabs 8.0.0-alpha.5 → 8.0.0-alpha.50
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/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createMaterialTopTabNavigator.js +10 -16
- package/lib/module/navigators/createMaterialTopTabNavigator.js.map +1 -1
- package/lib/module/utils/useTabAnimation.js +1 -1
- package/lib/module/utils/useTabAnimation.js.map +1 -1
- package/lib/module/views/MaterialTopTabBar.js +53 -24
- package/lib/module/views/MaterialTopTabBar.js.map +1 -1
- package/lib/module/views/MaterialTopTabView.js +71 -10
- package/lib/module/views/MaterialTopTabView.js.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -5
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createMaterialTopTabNavigator.d.ts +9 -15
- package/lib/typescript/src/navigators/createMaterialTopTabNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +61 -36
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/TabAnimationContext.d.ts +1 -1
- package/lib/typescript/src/utils/TabAnimationContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/useTabAnimation.d.ts +1 -1
- package/lib/typescript/src/utils/useTabAnimation.d.ts.map +1 -1
- package/lib/typescript/src/views/MaterialTopTabBar.d.ts +3 -2
- package/lib/typescript/src/views/MaterialTopTabBar.d.ts.map +1 -1
- package/lib/typescript/src/views/MaterialTopTabView.d.ts +2 -2
- package/lib/typescript/src/views/MaterialTopTabView.d.ts.map +1 -1
- package/package.json +19 -20
- package/src/index.tsx +1 -0
- package/src/navigators/createMaterialTopTabNavigator.tsx +34 -73
- package/src/types.tsx +76 -44
- package/src/utils/useTabAnimation.tsx +1 -1
- package/src/views/MaterialTopTabBar.tsx +76 -34
- package/src/views/MaterialTopTabView.tsx +100 -9
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Icon } from '@react-navigation/elements';
|
|
1
2
|
import type { DefaultNavigatorOptions, Descriptor, NavigationHelpers, NavigationProp, ParamListBase, Route, RouteProp, TabActionHelpers, TabNavigationState, TabRouterOptions, Theme } from '@react-navigation/native';
|
|
2
3
|
import type React from 'react';
|
|
3
4
|
import type { Animated, ColorValue, PressableAndroidRippleConfig, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
@@ -42,7 +43,7 @@ export type MaterialTopTabNavigationOptions = {
|
|
|
42
43
|
/**
|
|
43
44
|
* Title text for the screen.
|
|
44
45
|
*/
|
|
45
|
-
title?: string;
|
|
46
|
+
title?: string | undefined;
|
|
46
47
|
/**
|
|
47
48
|
* Title string of a tab displayed in the tab bar
|
|
48
49
|
* or a function that given { focused: boolean, color: ColorValue } returns a React.Node, to display in tab bar.
|
|
@@ -53,116 +54,128 @@ export type MaterialTopTabNavigationOptions = {
|
|
|
53
54
|
focused: boolean;
|
|
54
55
|
color: ColorValue;
|
|
55
56
|
children: string;
|
|
56
|
-
}) => React.ReactNode);
|
|
57
|
+
}) => React.ReactNode) | undefined;
|
|
57
58
|
/**
|
|
58
59
|
* Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.
|
|
59
60
|
* It's recommended to set this if you don't have a label for the tab.
|
|
60
61
|
*/
|
|
61
|
-
tabBarAccessibilityLabel?: string;
|
|
62
|
+
tabBarAccessibilityLabel?: string | undefined;
|
|
62
63
|
/**
|
|
63
64
|
* Whether label font should scale to respect Text Size accessibility settings.
|
|
64
65
|
*/
|
|
65
|
-
tabBarAllowFontScaling?: boolean;
|
|
66
|
+
tabBarAllowFontScaling?: boolean | undefined;
|
|
66
67
|
/**
|
|
67
68
|
* Whether the tab label should be visible. Defaults to `true`.
|
|
68
69
|
*/
|
|
69
|
-
tabBarShowLabel?: boolean;
|
|
70
|
+
tabBarShowLabel?: boolean | undefined;
|
|
70
71
|
/**
|
|
71
|
-
*
|
|
72
|
+
* Icon to display for the tab.
|
|
72
73
|
*/
|
|
73
|
-
tabBarIcon?: (props: {
|
|
74
|
+
tabBarIcon?: Icon | ((props: {
|
|
74
75
|
focused: boolean;
|
|
75
76
|
color: ColorValue;
|
|
76
|
-
|
|
77
|
+
size: number;
|
|
78
|
+
}) => Icon | React.ReactNode);
|
|
77
79
|
/**
|
|
78
80
|
* Whether the tab icon should be visible. Defaults to `false`.
|
|
79
81
|
*/
|
|
80
|
-
tabBarShowIcon?: boolean;
|
|
82
|
+
tabBarShowIcon?: boolean | undefined;
|
|
81
83
|
/**
|
|
82
84
|
* Function that returns a React element to use as a badge for the tab.
|
|
83
85
|
*/
|
|
84
|
-
tabBarBadge?: () => React.ReactElement;
|
|
86
|
+
tabBarBadge?: (() => React.ReactElement) | undefined;
|
|
85
87
|
/**
|
|
86
88
|
* Function that returns a React element as the tab bar indicator.
|
|
87
89
|
*/
|
|
88
|
-
tabBarIndicator?: (props: Omit<Parameters<NonNullable<React.ComponentProps<typeof TabBar>['renderIndicator']>>[0], 'navigationState'> & {
|
|
90
|
+
tabBarIndicator?: ((props: Omit<Parameters<NonNullable<React.ComponentProps<typeof TabBar>['renderIndicator']>>[0], 'navigationState'> & {
|
|
89
91
|
state: TabNavigationState<ParamListBase>;
|
|
90
|
-
}) => React.ReactNode;
|
|
92
|
+
}) => React.ReactNode) | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Variant of the tab bar.
|
|
95
|
+
*
|
|
96
|
+
* The following variants are available:
|
|
97
|
+
*
|
|
98
|
+
* - `primary`: the indicator matches the label & icon width and is centered under the tab.
|
|
99
|
+
* - `secondary`: the indicator spans the full tab width.
|
|
100
|
+
*
|
|
101
|
+
* Defaults to `primary`.
|
|
102
|
+
*/
|
|
103
|
+
tabBarVariant?: 'primary' | 'secondary' | undefined;
|
|
91
104
|
/**
|
|
92
105
|
* Style object for the tab bar indicator.
|
|
93
106
|
*/
|
|
94
|
-
tabBarIndicatorStyle?: StyleProp<ViewStyle
|
|
107
|
+
tabBarIndicatorStyle?: StyleProp<ViewStyle> | undefined;
|
|
95
108
|
/**
|
|
96
109
|
* Style object for the view containing the tab bar indicator.
|
|
97
110
|
*/
|
|
98
|
-
tabBarIndicatorContainerStyle?: StyleProp<ViewStyle
|
|
111
|
+
tabBarIndicatorContainerStyle?: StyleProp<ViewStyle> | undefined;
|
|
99
112
|
/**
|
|
100
113
|
* ID to locate this tab button in tests.
|
|
101
114
|
*/
|
|
102
|
-
tabBarButtonTestID?: string;
|
|
115
|
+
tabBarButtonTestID?: string | undefined;
|
|
103
116
|
/**
|
|
104
117
|
* Color for the icon and label in the active tab.
|
|
105
118
|
*/
|
|
106
|
-
tabBarActiveTintColor?: ColorValue;
|
|
119
|
+
tabBarActiveTintColor?: ColorValue | undefined;
|
|
107
120
|
/**
|
|
108
121
|
* Color for the icon and label in the inactive tabs.
|
|
109
122
|
*/
|
|
110
|
-
tabBarInactiveTintColor?: ColorValue;
|
|
123
|
+
tabBarInactiveTintColor?: ColorValue | undefined;
|
|
111
124
|
/**
|
|
112
125
|
* Color for material ripple (Android >= 5.0 only).
|
|
113
126
|
*/
|
|
114
|
-
tabBarPressColor?: ColorValue;
|
|
127
|
+
tabBarPressColor?: ColorValue | undefined;
|
|
115
128
|
/**
|
|
116
129
|
* Opacity for pressed tab (iOS and Android < 5.0 only).
|
|
117
130
|
*/
|
|
118
|
-
tabBarPressOpacity?: number;
|
|
131
|
+
tabBarPressOpacity?: number | undefined;
|
|
119
132
|
/**
|
|
120
133
|
* Boolean indicating whether the tab bar bounces when overscrolling.
|
|
121
134
|
*/
|
|
122
|
-
tabBarBounces?: boolean;
|
|
135
|
+
tabBarBounces?: boolean | undefined;
|
|
123
136
|
/**
|
|
124
137
|
* Boolean indicating whether to make the tab bar scrollable.
|
|
125
138
|
*
|
|
126
139
|
* If you set this to `true`, you should also specify a width in `tabBarItemStyle` to improve the performance of initial render.
|
|
127
140
|
*/
|
|
128
|
-
tabBarScrollEnabled?: boolean;
|
|
141
|
+
tabBarScrollEnabled?: boolean | undefined;
|
|
129
142
|
/**
|
|
130
143
|
* Style object for the tab label.
|
|
131
144
|
*/
|
|
132
|
-
tabBarLabelStyle?: StyleProp<TextStyle
|
|
145
|
+
tabBarLabelStyle?: StyleProp<TextStyle> | undefined;
|
|
133
146
|
/**
|
|
134
147
|
* Style object for the individual tab items.
|
|
135
148
|
*/
|
|
136
|
-
tabBarItemStyle?: StyleProp<ViewStyle
|
|
149
|
+
tabBarItemStyle?: StyleProp<ViewStyle> | undefined;
|
|
137
150
|
/**
|
|
138
151
|
* Style object for the view containing the tab items.
|
|
139
152
|
*/
|
|
140
|
-
tabBarContentContainerStyle?: StyleProp<ViewStyle
|
|
153
|
+
tabBarContentContainerStyle?: StyleProp<ViewStyle> | undefined;
|
|
141
154
|
/**
|
|
142
155
|
* Style object for the the tab bar.
|
|
143
156
|
*/
|
|
144
|
-
tabBarStyle?: StyleProp<ViewStyle
|
|
157
|
+
tabBarStyle?: StyleProp<ViewStyle> | undefined;
|
|
145
158
|
/**
|
|
146
159
|
* Gap between tabs
|
|
147
160
|
*/
|
|
148
|
-
tabBarGap?: number;
|
|
161
|
+
tabBarGap?: number | undefined;
|
|
149
162
|
/**
|
|
150
163
|
* Allows to customize the android ripple effect (Android >= 5.0 only).
|
|
151
164
|
*
|
|
152
|
-
* Default: `{ borderless: true }`
|
|
165
|
+
* Default: `{ borderless: false, foreground: true }`
|
|
153
166
|
*/
|
|
154
|
-
tabBarAndroidRipple?: PressableAndroidRippleConfig;
|
|
167
|
+
tabBarAndroidRipple?: PressableAndroidRippleConfig | undefined;
|
|
155
168
|
/**
|
|
156
169
|
* Whether to enable swipe gestures when this screen is focused.
|
|
157
170
|
* Swipe gestures are enabled by default. Passing `false` will disable swipe gestures,
|
|
158
171
|
* but the user can still switch tabs by pressing the tab bar.
|
|
159
172
|
*/
|
|
160
|
-
swipeEnabled?: boolean;
|
|
173
|
+
swipeEnabled?: boolean | undefined;
|
|
161
174
|
/**
|
|
162
175
|
* Whether to enable animations when switching between tabs by pressing on the tab bar or programmatically.
|
|
163
176
|
* Switching tab via swipe gesture will still result in an animation.
|
|
164
177
|
*/
|
|
165
|
-
animationEnabled?: boolean;
|
|
178
|
+
animationEnabled?: boolean | undefined;
|
|
166
179
|
/**
|
|
167
180
|
* Whether this screen should be lazily rendered. When this is set to `true`,
|
|
168
181
|
* the screen will be rendered as it comes into the viewport.
|
|
@@ -174,12 +187,12 @@ export type MaterialTopTabNavigationOptions = {
|
|
|
174
187
|
* when they come into the viewport. You can use the `lazyPlaceholder` prop to customize
|
|
175
188
|
* what the user sees during this short period.
|
|
176
189
|
*/
|
|
177
|
-
lazy?: boolean;
|
|
190
|
+
lazy?: boolean | undefined;
|
|
178
191
|
/**
|
|
179
192
|
* When `lazy` is enabled, you can specify how many adjacent screens should be preloaded in advance with this prop.
|
|
180
193
|
* This value defaults to `0` which means lazy pages are loaded as they come into the viewport.
|
|
181
194
|
*/
|
|
182
|
-
lazyPreloadDistance?: number;
|
|
195
|
+
lazyPreloadDistance?: number | undefined;
|
|
183
196
|
/**
|
|
184
197
|
* Function that returns a React element to render if this screen hasn't been rendered yet.
|
|
185
198
|
* The `lazy` option also needs to be enabled for this to work.
|
|
@@ -188,11 +201,23 @@ export type MaterialTopTabNavigationOptions = {
|
|
|
188
201
|
*
|
|
189
202
|
* By default, this renders `null`.
|
|
190
203
|
*/
|
|
191
|
-
lazyPlaceholder?: () => React.ReactNode;
|
|
204
|
+
lazyPlaceholder?: (() => React.ReactNode) | undefined;
|
|
192
205
|
/**
|
|
193
206
|
* Style object for the component wrapping the screen content.
|
|
194
207
|
*/
|
|
195
|
-
sceneStyle?: StyleProp<ViewStyle
|
|
208
|
+
sceneStyle?: StyleProp<ViewStyle> | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* What should happen when screens become inactive.
|
|
211
|
+
* - `pause`: Effects are cleaned up.
|
|
212
|
+
* - `none`: Screen renders normally
|
|
213
|
+
*
|
|
214
|
+
* Defaults to `pause`.
|
|
215
|
+
*
|
|
216
|
+
* If you set `lazy: false` or preload a screen,
|
|
217
|
+
* It won't be paused until after the first time it becomes focused.
|
|
218
|
+
* This makes sure that effects are run to initialize the screen.
|
|
219
|
+
*/
|
|
220
|
+
inactiveBehavior?: ('pause' | 'none') | undefined;
|
|
196
221
|
};
|
|
197
222
|
export type MaterialTopTabDescriptor = Descriptor<MaterialTopTabNavigationOptions, MaterialTopTabNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
|
|
198
223
|
export type MaterialTopTabDescriptorMap = Record<string, MaterialTopTabDescriptor>;
|
|
@@ -200,11 +225,11 @@ export type MaterialTopTabNavigationConfig = Omit<TabViewProps<Route<string>>, '
|
|
|
200
225
|
/**
|
|
201
226
|
* Function that returns a React element to display as the tab bar.
|
|
202
227
|
*/
|
|
203
|
-
tabBar?: (props: MaterialTopTabBarProps) => React.ReactNode;
|
|
228
|
+
tabBar?: ((props: MaterialTopTabBarProps) => React.ReactNode) | undefined;
|
|
204
229
|
/**
|
|
205
230
|
* Function that returns a React element to override the underlying adapter.
|
|
206
231
|
*/
|
|
207
|
-
adapter?: TabViewProps<Route<string>>['renderAdapter'];
|
|
232
|
+
adapter?: TabViewProps<Route<string>>['renderAdapter'] | undefined;
|
|
208
233
|
};
|
|
209
234
|
export type MaterialTopTabBarProps = Pick<TabBarProps<Route<string>>, 'position' | 'subscribe' | 'jumpTo'> & {
|
|
210
235
|
state: TabNavigationState<ParamListBase>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,EACN,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,4BAA4B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,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EACzB,iBAAiB,GACjB,eAAe,GACf,cAAc,GACd,YAAY,GACZ,aAAa,GACb,cAAc,GACd,uBAAuB,GACvB,eAAe,GACf,cAAc,GACd,kBAAkB,GAClB,MAAM,GACN,qBAAqB,GACrB,iBAAiB,CACpB,GAAG;IACF;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAC1E;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;CACpE,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAC1B,UAAU,GAAG,WAAW,GAAG,QAAQ,CACpC,GAAG;IACF,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,UAAU,EAAE,iBAAiB,CAC3B,aAAa,EACb,gCAAgC,CACjC,CAAC;IACF,WAAW,EAAE,2BAA2B,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,QAAQ,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,uBAAuB,CAChE,aAAa,EACb,kBAAkB,CAAC,aAAa,CAAC,EACjC,+BAA+B,EAC/B,gCAAgC,EAChC,4BAA4B,CAAC,aAAa,CAAC,CAC5C,GACC,gBAAgB,GAChB,8BAA8B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { MaterialTopTabAnimationContext } from '../types';
|
|
2
|
+
import type { MaterialTopTabAnimationContext } from '../types.js';
|
|
3
3
|
export declare const TabAnimationContext: React.Context<MaterialTopTabAnimationContext | undefined>;
|
|
4
4
|
//# sourceMappingURL=TabAnimationContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabAnimationContext.d.ts","sourceRoot":"","sources":["../../../../src/utils/TabAnimationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TabAnimationContext.d.ts","sourceRoot":"","sources":["../../../../src/utils/TabAnimationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAU,CAAC;AAE/D,eAAO,MAAM,mBAAmB,2DAEpB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function useTabAnimation(): import("../types").MaterialTopTabAnimationContext;
|
|
1
|
+
export declare function useTabAnimation(): import("../types.js").MaterialTopTabAnimationContext;
|
|
2
2
|
//# sourceMappingURL=useTabAnimation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTabAnimation.d.ts","sourceRoot":"","sources":["../../../../src/utils/useTabAnimation.tsx"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"useTabAnimation.d.ts","sourceRoot":"","sources":["../../../../src/utils/useTabAnimation.tsx"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,yDAU9B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MaterialTopTabBarProps } from '../types.js';
|
|
3
|
+
export declare function MaterialTopTabBar({ state, navigation, descriptors, ...rest }: MaterialTopTabBarProps): React.JSX.Element;
|
|
3
4
|
//# sourceMappingURL=MaterialTopTabBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialTopTabBar.d.ts","sourceRoot":"","sources":["../../../../src/views/MaterialTopTabBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MaterialTopTabBar.d.ts","sourceRoot":"","sources":["../../../../src/views/MaterialTopTabBar.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAU,CAAC;AA4BvD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,UAAU,EACV,WAAW,EACX,GAAG,IAAI,EACR,EAAE,sBAAsB,qBAyKxB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type ParamListBase, type TabNavigationState } from '@react-navigation/native';
|
|
2
|
-
import type { MaterialTopTabDescriptorMap, MaterialTopTabNavigationConfig, MaterialTopTabNavigationHelpers } from '../types';
|
|
2
|
+
import type { MaterialTopTabDescriptorMap, MaterialTopTabNavigationConfig, MaterialTopTabNavigationHelpers } from '../types.js';
|
|
3
3
|
type Props = MaterialTopTabNavigationConfig & {
|
|
4
4
|
state: TabNavigationState<ParamListBase>;
|
|
5
5
|
navigation: MaterialTopTabNavigationHelpers;
|
|
6
6
|
descriptors: MaterialTopTabDescriptorMap;
|
|
7
7
|
};
|
|
8
|
-
export declare function MaterialTopTabView({ tabBar, state, navigation, descriptors, ...rest }: Props): import("react
|
|
8
|
+
export declare function MaterialTopTabView({ tabBar, state, navigation, descriptors, ...rest }: Props): import("react").JSX.Element;
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=MaterialTopTabView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialTopTabView.d.ts","sourceRoot":"","sources":["../../../../src/views/MaterialTopTabView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MaterialTopTabView.d.ts","sourceRoot":"","sources":["../../../../src/views/MaterialTopTabView.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EAGxB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EAEV,2BAA2B,EAC3B,8BAA8B,EAC9B,+BAA+B,EAEhC,MAAM,aAAU,CAAC;AAIlB,KAAK,KAAK,GAAG,8BAA8B,GAAG;IAC5C,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,UAAU,EAAE,+BAA+B,CAAC;IAC5C,WAAW,EAAE,2BAA2B,CAAC;CAC1C,CAAC;AAMF,wBAAgB,kBAAkB,CAAC,EACjC,MAA4B,EAC5B,KAAK,EACL,UAAU,EACV,WAAW,EACX,GAAG,IAAI,EACR,EAAE,KAAK,+BAwGP"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/material-top-tabs",
|
|
3
3
|
"description": "Integration for the animated tab view component from react-native-tab-view",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.50",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"types": "./lib/typescript/src/index.d.ts",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
-
"source": "./src/index.tsx",
|
|
29
|
+
"@react-navigation/source": "./src/index.tsx",
|
|
30
30
|
"types": "./lib/typescript/src/index.d.ts",
|
|
31
31
|
"default": "./lib/module/index.js"
|
|
32
32
|
},
|
|
@@ -46,27 +46,26 @@
|
|
|
46
46
|
"clean": "del lib"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@react-navigation/elements": "^3.0.0-alpha.
|
|
50
|
-
"
|
|
51
|
-
"react-native-tab-view": "^5.0.0-alpha.1"
|
|
49
|
+
"@react-navigation/elements": "^3.0.0-alpha.49",
|
|
50
|
+
"react-native-tab-view": "^5.0.0-alpha.15"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"@jest/globals": "^30.
|
|
55
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
56
|
-
"@testing-library/react-native": "^
|
|
57
|
-
"@types/react": "~19.
|
|
58
|
-
"del-cli": "^
|
|
59
|
-
"react": "19.
|
|
60
|
-
"react-native": "0.
|
|
61
|
-
"react-native-builder-bob": "^0.
|
|
62
|
-
"react-native-pager-view": "^8.0.
|
|
63
|
-
"react-native-safe-area-context": "~5.
|
|
64
|
-
"
|
|
65
|
-
"typescript": "^
|
|
53
|
+
"@jest/globals": "^30.4.1",
|
|
54
|
+
"@react-navigation/native": "^8.0.0-alpha.45",
|
|
55
|
+
"@testing-library/react-native": "^14.0.0",
|
|
56
|
+
"@types/react": "~19.2.17",
|
|
57
|
+
"del-cli": "^7.0.0",
|
|
58
|
+
"react": "19.2.3",
|
|
59
|
+
"react-native": "0.85.3",
|
|
60
|
+
"react-native-builder-bob": "^0.43.0",
|
|
61
|
+
"react-native-pager-view": "^8.0.1",
|
|
62
|
+
"react-native-safe-area-context": "~5.7.0",
|
|
63
|
+
"test-renderer": "1.2.0",
|
|
64
|
+
"typescript": "^6.0.3"
|
|
66
65
|
},
|
|
67
66
|
"peerDependencies": {
|
|
68
|
-
"@react-navigation/native": "^8.0.0-alpha.
|
|
69
|
-
"react": ">= 19.
|
|
67
|
+
"@react-navigation/native": "^8.0.0-alpha.45",
|
|
68
|
+
"react": ">= 19.2.0",
|
|
70
69
|
"react-native": "*",
|
|
71
70
|
"react-native-pager-view": ">= 7.0.0",
|
|
72
71
|
"react-native-safe-area-context": ">= 5.5.0"
|
|
@@ -89,5 +88,5 @@
|
|
|
89
88
|
]
|
|
90
89
|
]
|
|
91
90
|
},
|
|
92
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "400f7128965fc92c335a3f6c27e3fa26113915e4"
|
|
93
92
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createNavigatorFactory,
|
|
3
|
+
createScreenFactory,
|
|
4
|
+
type NavigatorTypeBagBase,
|
|
3
5
|
type ParamListBase,
|
|
4
|
-
type StaticConfig,
|
|
5
|
-
type StaticParamList,
|
|
6
|
-
type StaticScreenConfig,
|
|
7
|
-
type StaticScreenConfigLinking,
|
|
8
|
-
type StaticScreenConfigScreen,
|
|
9
6
|
type TabActionHelpers,
|
|
10
7
|
type TabNavigationState,
|
|
11
8
|
TabRouter,
|
|
12
9
|
type TabRouterOptions,
|
|
13
|
-
type TypedNavigator,
|
|
14
10
|
useNavigationBuilder,
|
|
15
11
|
} from '@react-navigation/native';
|
|
16
12
|
|
|
17
13
|
import type {
|
|
18
14
|
MaterialTopTabNavigationEventMap,
|
|
19
15
|
MaterialTopTabNavigationOptions,
|
|
20
|
-
MaterialTopTabNavigationProp,
|
|
21
16
|
MaterialTopTabNavigatorProps,
|
|
22
17
|
} from '../types';
|
|
23
18
|
import { MaterialTopTabView } from '../views/MaterialTopTabView';
|
|
@@ -34,78 +29,44 @@ function MaterialTopTabNavigator({
|
|
|
34
29
|
router,
|
|
35
30
|
...rest
|
|
36
31
|
}: MaterialTopTabNavigatorProps) {
|
|
37
|
-
const { state, descriptors, navigation,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
32
|
+
const { state, descriptors, navigation, render } = useNavigationBuilder<
|
|
33
|
+
TabNavigationState<ParamListBase>,
|
|
34
|
+
TabRouterOptions,
|
|
35
|
+
TabActionHelpers<ParamListBase>,
|
|
36
|
+
MaterialTopTabNavigationOptions,
|
|
37
|
+
MaterialTopTabNavigationEventMap
|
|
38
|
+
>(TabRouter, {
|
|
39
|
+
initialRouteName,
|
|
40
|
+
backBehavior,
|
|
41
|
+
routeNamesChangeBehavior,
|
|
42
|
+
children,
|
|
43
|
+
layout,
|
|
44
|
+
screenListeners,
|
|
45
|
+
screenOptions,
|
|
46
|
+
screenLayout,
|
|
47
|
+
router,
|
|
48
|
+
});
|
|
55
49
|
|
|
56
|
-
return (
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/>
|
|
64
|
-
</NavigationContent>
|
|
50
|
+
return render(
|
|
51
|
+
<MaterialTopTabView
|
|
52
|
+
{...rest}
|
|
53
|
+
state={state}
|
|
54
|
+
navigation={navigation}
|
|
55
|
+
descriptors={descriptors}
|
|
56
|
+
/>
|
|
65
57
|
);
|
|
66
58
|
}
|
|
67
59
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
State: TabNavigationState<ParamList>;
|
|
60
|
+
export interface MaterialTopTabTypeBag extends NavigatorTypeBagBase {
|
|
61
|
+
State: TabNavigationState<this['ParamList']>;
|
|
71
62
|
ScreenOptions: MaterialTopTabNavigationOptions;
|
|
72
63
|
EventMap: MaterialTopTabNavigationEventMap;
|
|
73
|
-
|
|
74
|
-
[RouteName in keyof ParamList]: MaterialTopTabNavigationProp<
|
|
75
|
-
ParamList,
|
|
76
|
-
RouteName
|
|
77
|
-
>;
|
|
78
|
-
};
|
|
64
|
+
ActionHelpers: TabActionHelpers<this['ParamList']>;
|
|
79
65
|
Navigator: typeof MaterialTopTabNavigator;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export function createMaterialTopTabNavigator<
|
|
83
|
-
const ParamList extends ParamListBase,
|
|
84
|
-
>(): TypedNavigator<MaterialTopTabTypeBag<ParamList>, undefined>;
|
|
85
|
-
export function createMaterialTopTabNavigator<
|
|
86
|
-
const Config extends StaticConfig<MaterialTopTabTypeBag<ParamListBase>>,
|
|
87
|
-
>(
|
|
88
|
-
config: Config
|
|
89
|
-
): TypedNavigator<
|
|
90
|
-
MaterialTopTabTypeBag<StaticParamList<{ config: Config }>>,
|
|
91
|
-
Config
|
|
92
|
-
>;
|
|
93
|
-
export function createMaterialTopTabNavigator(config?: unknown) {
|
|
94
|
-
return createNavigatorFactory(MaterialTopTabNavigator)(config);
|
|
95
66
|
}
|
|
96
67
|
|
|
97
|
-
export
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Linking,
|
|
103
|
-
Screen,
|
|
104
|
-
TabNavigationState<ParamListBase>,
|
|
105
|
-
MaterialTopTabNavigationOptions,
|
|
106
|
-
MaterialTopTabNavigationEventMap,
|
|
107
|
-
MaterialTopTabNavigationProp<ParamListBase>
|
|
108
|
-
>
|
|
109
|
-
) {
|
|
110
|
-
return config;
|
|
111
|
-
}
|
|
68
|
+
export const createMaterialTopTabNavigator =
|
|
69
|
+
createNavigatorFactory<MaterialTopTabTypeBag>(MaterialTopTabNavigator);
|
|
70
|
+
|
|
71
|
+
export const createMaterialTopTabScreen =
|
|
72
|
+
createScreenFactory<MaterialTopTabTypeBag>();
|