1 | import type { HeaderOptions } from '@react-navigation/elements';
|
2 | import type { DefaultNavigatorOptions, Descriptor, NavigationHelpers, NavigationProp, ParamListBase, RouteProp, TabActionHelpers, TabNavigationState, TabRouterOptions, Theme } from '@react-navigation/native';
|
3 | import type * as React from 'react';
|
4 | import type { Animated, GestureResponderEvent, Pressable, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
5 | import type { EdgeInsets } from 'react-native-safe-area-context';
|
6 | export type Layout = {
|
7 | width: number;
|
8 | height: number;
|
9 | };
|
10 | export type Variant = 'uikit' | 'material';
|
11 | export type BottomTabNavigationEventMap = {
|
12 | |
13 |
|
14 |
|
15 | tabPress: {
|
16 | data: undefined;
|
17 | canPreventDefault: true;
|
18 | };
|
19 | |
20 |
|
21 |
|
22 | tabLongPress: {
|
23 | data: undefined;
|
24 | };
|
25 | |
26 |
|
27 |
|
28 | transitionStart: {
|
29 | data: undefined;
|
30 | };
|
31 | |
32 |
|
33 |
|
34 | transitionEnd: {
|
35 | data: undefined;
|
36 | };
|
37 | };
|
38 | export type LabelPosition = 'beside-icon' | 'below-icon';
|
39 | export type BottomTabNavigationHelpers = NavigationHelpers<ParamListBase, BottomTabNavigationEventMap> & TabActionHelpers<ParamListBase>;
|
40 | export type BottomTabNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = NavigationProp<ParamList, RouteName, NavigatorID, TabNavigationState<ParamList>, BottomTabNavigationOptions, BottomTabNavigationEventMap> & TabActionHelpers<ParamList>;
|
41 | export type BottomTabScreenProps<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = {
|
42 | navigation: BottomTabNavigationProp<ParamList, RouteName, NavigatorID>;
|
43 | route: RouteProp<ParamList, RouteName>;
|
44 | };
|
45 | export type BottomTabOptionsArgs<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = BottomTabScreenProps<ParamList, RouteName, NavigatorID> & {
|
46 | theme: Theme;
|
47 | };
|
48 | export type TimingKeyboardAnimationConfig = {
|
49 | animation: 'timing';
|
50 | config?: Omit<Partial<Animated.TimingAnimationConfig>, 'toValue' | 'useNativeDriver'>;
|
51 | };
|
52 | export type SpringKeyboardAnimationConfig = {
|
53 | animation: 'spring';
|
54 | config?: Omit<Partial<Animated.SpringAnimationConfig>, 'toValue' | 'useNativeDriver'>;
|
55 | };
|
56 | export type TabBarVisibilityAnimationConfig = TimingKeyboardAnimationConfig | SpringKeyboardAnimationConfig;
|
57 | export type TabAnimationName = 'none' | 'fade' | 'shift';
|
58 | export type BottomTabNavigationOptions = HeaderOptions & {
|
59 | |
60 |
|
61 |
|
62 | title?: string;
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | tabBarLabel?: string | ((props: {
|
70 | focused: boolean;
|
71 | color: string;
|
72 | position: LabelPosition;
|
73 | children: string;
|
74 | }) => React.ReactNode);
|
75 | |
76 |
|
77 |
|
78 | tabBarShowLabel?: boolean;
|
79 | |
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | tabBarLabelPosition?: LabelPosition;
|
88 | |
89 |
|
90 |
|
91 | tabBarLabelStyle?: StyleProp<TextStyle>;
|
92 | |
93 |
|
94 |
|
95 | tabBarAllowFontScaling?: boolean;
|
96 | |
97 |
|
98 |
|
99 | tabBarIcon?: (props: {
|
100 | focused: boolean;
|
101 | color: string;
|
102 | size: number;
|
103 | }) => React.ReactNode;
|
104 | |
105 |
|
106 |
|
107 | tabBarIconStyle?: StyleProp<TextStyle>;
|
108 | |
109 |
|
110 |
|
111 | tabBarBadge?: number | string;
|
112 | |
113 |
|
114 |
|
115 |
|
116 | tabBarBadgeStyle?: StyleProp<TextStyle>;
|
117 | |
118 |
|
119 |
|
120 |
|
121 | tabBarAccessibilityLabel?: string;
|
122 | |
123 |
|
124 |
|
125 | tabBarButtonTestID?: string;
|
126 | |
127 |
|
128 |
|
129 |
|
130 | tabBarButton?: (props: BottomTabBarButtonProps) => React.ReactNode;
|
131 | |
132 |
|
133 |
|
134 | tabBarActiveTintColor?: string;
|
135 | |
136 |
|
137 |
|
138 | tabBarInactiveTintColor?: string;
|
139 | |
140 |
|
141 |
|
142 | tabBarActiveBackgroundColor?: string;
|
143 | |
144 |
|
145 |
|
146 | tabBarInactiveBackgroundColor?: string;
|
147 | |
148 |
|
149 |
|
150 | tabBarItemStyle?: StyleProp<ViewStyle>;
|
151 | |
152 |
|
153 |
|
154 | tabBarHideOnKeyboard?: boolean;
|
155 | |
156 |
|
157 |
|
158 | tabBarVisibilityAnimationConfig?: {
|
159 | show?: TabBarVisibilityAnimationConfig;
|
160 | hide?: TabBarVisibilityAnimationConfig;
|
161 | };
|
162 | |
163 |
|
164 |
|
165 | tabBarVariant?: Variant;
|
166 | |
167 |
|
168 |
|
169 | tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
170 | |
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 | tabBarBackground?: () => React.ReactNode;
|
178 | |
179 |
|
180 |
|
181 | tabBarPosition?: 'bottom' | 'left' | 'right' | 'top';
|
182 | |
183 |
|
184 |
|
185 |
|
186 | lazy?: boolean;
|
187 | |
188 |
|
189 |
|
190 | header?: (props: BottomTabHeaderProps) => React.ReactNode;
|
191 | |
192 |
|
193 |
|
194 |
|
195 | headerShown?: boolean;
|
196 | |
197 |
|
198 |
|
199 |
|
200 | popToTopOnBlur?: boolean;
|
201 | |
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 | freezeOnBlur?: boolean;
|
209 | |
210 |
|
211 |
|
212 | sceneStyle?: StyleProp<ViewStyle>;
|
213 | |
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 | animation?: TabAnimationName;
|
222 | |
223 |
|
224 |
|
225 | sceneStyleInterpolator?: BottomTabSceneStyleInterpolator;
|
226 | |
227 |
|
228 |
|
229 | transitionSpec?: TransitionSpec;
|
230 | };
|
231 | export type BottomTabDescriptor = Descriptor<BottomTabNavigationOptions, BottomTabNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
|
232 | export type BottomTabDescriptorMap = Record<string, BottomTabDescriptor>;
|
233 | export type BottomTabSceneInterpolationProps = {
|
234 | |
235 |
|
236 |
|
237 | current: {
|
238 | |
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 | progress: Animated.Value;
|
245 | };
|
246 | };
|
247 | export type BottomTabSceneInterpolatedStyle = {
|
248 | |
249 |
|
250 |
|
251 | sceneStyle: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
252 | };
|
253 | export type BottomTabSceneStyleInterpolator = (props: BottomTabSceneInterpolationProps) => BottomTabSceneInterpolatedStyle;
|
254 | export type TransitionSpec = {
|
255 | animation: 'timing';
|
256 | config: Omit<Animated.TimingAnimationConfig, 'toValue' | keyof Animated.AnimationConfig>;
|
257 | } | {
|
258 | animation: 'spring';
|
259 | config: Omit<Animated.SpringAnimationConfig, 'toValue' | keyof Animated.AnimationConfig>;
|
260 | };
|
261 | export type BottomTabTransitionPreset = {
|
262 | |
263 |
|
264 |
|
265 | animationEnabled?: boolean;
|
266 | |
267 |
|
268 |
|
269 | sceneStyleInterpolator?: BottomTabSceneStyleInterpolator;
|
270 | |
271 |
|
272 |
|
273 | transitionSpec?: TransitionSpec;
|
274 | };
|
275 | export type BottomTabNavigationConfig = {
|
276 | |
277 |
|
278 |
|
279 | tabBar?: (props: BottomTabBarProps) => React.ReactNode;
|
280 | |
281 |
|
282 |
|
283 |
|
284 | safeAreaInsets?: {
|
285 | top?: number;
|
286 | right?: number;
|
287 | bottom?: number;
|
288 | left?: number;
|
289 | };
|
290 | |
291 |
|
292 |
|
293 |
|
294 |
|
295 | detachInactiveScreens?: boolean;
|
296 | };
|
297 | export type BottomTabHeaderProps = {
|
298 | |
299 |
|
300 |
|
301 | layout: Layout;
|
302 | |
303 |
|
304 |
|
305 | options: BottomTabNavigationOptions;
|
306 | |
307 |
|
308 |
|
309 | route: RouteProp<ParamListBase>;
|
310 | |
311 |
|
312 |
|
313 | navigation: BottomTabNavigationProp<ParamListBase>;
|
314 | };
|
315 | export type BottomTabBarProps = {
|
316 | state: TabNavigationState<ParamListBase>;
|
317 | descriptors: BottomTabDescriptorMap;
|
318 | navigation: NavigationHelpers<ParamListBase, BottomTabNavigationEventMap>;
|
319 | insets: EdgeInsets;
|
320 | };
|
321 | export type BottomTabBarButtonProps = Omit<React.ComponentProps<typeof Pressable>, 'style'> & {
|
322 | href?: string;
|
323 | children: React.ReactNode;
|
324 | style?: StyleProp<ViewStyle>;
|
325 | onPress?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent) => void;
|
326 | };
|
327 | export type BottomTabNavigatorProps = DefaultNavigatorOptions<ParamListBase, string | undefined, TabNavigationState<ParamListBase>, BottomTabNavigationOptions, BottomTabNavigationEventMap, BottomTabNavigationProp<ParamListBase>> & TabRouterOptions & BottomTabNavigationConfig;
|
328 |
|
\ | No newline at end of file |