UNPKG

8.26 kBTypeScriptView Raw
1import * as React from 'react';
2import { AccessibilityRole, AccessibilityState, StyleProp, TextStyle, ViewStyle } from 'react-native';
3import Animated from 'react-native-reanimated';
4import { NavigationRoute, NavigationState, NavigationScreenProp, NavigationParams, NavigationDescriptor, NavigationScreenConfig, SupportedThemes } from 'react-navigation';
5export declare type NavigationTabState = NavigationState;
6export declare type NavigationTabProp<State = NavigationRoute, Params = NavigationParams> = NavigationScreenProp<State, Params> & {
7 jumpTo(routeName: string, key?: string): void;
8};
9export declare type ThemedColor = string | {
10 light: string;
11 dark: string;
12};
13export declare type Orientation = 'horizontal' | 'vertical';
14export declare type LabelPosition = 'beside-icon' | 'below-icon';
15interface BaseAnimation {
16 useNativeDriver?: boolean;
17}
18interface TimingAnimation extends BaseAnimation {
19 easing?: (value: number) => number;
20 duration?: number;
21 delay?: number;
22}
23interface SpringAnimation extends BaseAnimation {
24 overshootClamping?: boolean;
25 restDisplacementThreshold?: number;
26 restSpeedThreshold?: number;
27 velocity?: number | {
28 x: number;
29 y: number;
30 };
31 bounciness?: number;
32 speed?: number;
33 tension?: number;
34 friction?: number;
35 stiffness?: number;
36 mass?: number;
37 damping?: number;
38 delay?: number;
39}
40export declare type TimingKeyboardAnimationConfig = {
41 animation: 'timing';
42 config?: TimingAnimation;
43};
44export declare type SpringKeyboardAnimationConfig = {
45 animation: 'spring';
46 config?: SpringAnimation;
47};
48export declare type KeyboardAnimationConfig = TimingKeyboardAnimationConfig | SpringKeyboardAnimationConfig;
49export declare type KeyboardHidesTabBarAnimationConfig = {
50 show: KeyboardAnimationConfig;
51 hide: KeyboardAnimationConfig;
52};
53export declare type BottomTabBarOptions = {
54 keyboardHidesTabBar?: boolean;
55 keyboardHidesTabBarAnimationConfig?: Partial<KeyboardHidesTabBarAnimationConfig>;
56 activeTintColor?: ThemedColor;
57 inactiveTintColor?: ThemedColor;
58 activeBackgroundColor?: ThemedColor;
59 inactiveBackgroundColor?: ThemedColor;
60 allowFontScaling?: boolean;
61 showLabel?: boolean;
62 showIcon?: boolean;
63 labelStyle?: StyleProp<TextStyle>;
64 tabStyle?: StyleProp<ViewStyle>;
65 labelPosition?: LabelPosition | ((options: {
66 deviceOrientation: Orientation;
67 }) => LabelPosition);
68 adaptive?: boolean;
69 safeAreaInset?: {
70 top?: 'always' | 'never' | number;
71 right?: 'always' | 'never' | number;
72 bottom?: 'always' | 'never' | number;
73 left?: 'always' | 'never' | number;
74 };
75 style?: StyleProp<ViewStyle>;
76};
77export declare type ButtonComponentProps = {
78 route: NavigationRoute;
79 focused: boolean;
80 onPress: () => void;
81 onLongPress: () => void;
82 testID?: string;
83 accessibilityLabel?: string;
84 accessibilityRole?: AccessibilityRole;
85 accessibilityState?: AccessibilityState;
86 accessibilityStates?: string[];
87 style?: StyleProp<ViewStyle>;
88};
89export declare type BottomTabBarProps = BottomTabBarOptions & {
90 navigation: NavigationTabProp;
91 onTabPress: (props: {
92 route: NavigationRoute;
93 }) => void;
94 onTabLongPress: (props: {
95 route: NavigationRoute;
96 }) => void;
97 getAccessibilityLabel: (props: {
98 route: NavigationRoute;
99 }) => string | undefined;
100 getAccessibilityRole: (props: {
101 route: NavigationRoute;
102 }) => AccessibilityRole | undefined;
103 getAccessibilityStates: (props: {
104 route: NavigationRoute;
105 focused: boolean;
106 }) => string[];
107 getButtonComponent: (props: {
108 route: NavigationRoute;
109 }) => React.ComponentType<ButtonComponentProps> | undefined;
110 getLabelText: (props: {
111 route: NavigationRoute;
112 }) => ((scene: {
113 focused: boolean;
114 tintColor?: string;
115 orientation?: 'horizontal' | 'vertical';
116 }) => string | undefined) | string | undefined;
117 getTestID: (props: {
118 route: NavigationRoute;
119 }) => string | undefined;
120 renderIcon: (props: {
121 route: NavigationRoute;
122 focused: boolean;
123 tintColor?: string;
124 horizontal?: boolean;
125 }) => React.ReactNode;
126 dimensions: {
127 width: number;
128 height: number;
129 };
130 isLandscape: boolean;
131 jumpTo: (key: string) => void;
132 screenProps: unknown;
133 detachInactiveScreens?: boolean;
134};
135export declare type MaterialTabBarOptions = {
136 activeTintColor?: string;
137 allowFontScaling?: boolean;
138 bounces?: boolean;
139 inactiveTintColor?: string;
140 pressColor?: string;
141 pressOpacity?: number;
142 scrollEnabled?: boolean;
143 showIcon?: boolean;
144 showLabel?: boolean;
145 upperCaseLabel?: boolean;
146 tabStyle?: StyleProp<ViewStyle>;
147 indicatorStyle?: StyleProp<ViewStyle>;
148 iconStyle?: StyleProp<ViewStyle>;
149 labelStyle?: StyleProp<TextStyle>;
150 contentContainerStyle?: StyleProp<ViewStyle>;
151 style?: StyleProp<ViewStyle>;
152};
153export declare type MaterialTabBarProps = MaterialTabBarOptions & {
154 layout: {
155 width: number;
156 height: number;
157 };
158 position: Animated.Node<number>;
159 jumpTo: (key: string) => void;
160 getLabelText: (scene: {
161 route: NavigationRoute;
162 }) => ((scene: {
163 focused: boolean;
164 tintColor: string;
165 }) => string | undefined) | string | undefined;
166 getAccessible?: (scene: {
167 route: NavigationRoute;
168 }) => boolean | undefined;
169 getAccessibilityLabel: (scene: {
170 route: NavigationRoute;
171 }) => string | undefined;
172 getTestID: (scene: {
173 route: NavigationRoute;
174 }) => string | undefined;
175 renderIcon: (scene: {
176 route: NavigationRoute;
177 focused: boolean;
178 tintColor: string;
179 horizontal?: boolean;
180 }) => React.ReactNode;
181 renderBadge?: (scene: {
182 route: NavigationRoute;
183 }) => React.ReactNode;
184 onTabPress?: (scene: {
185 route: NavigationRoute;
186 }) => void;
187 onTabLongPress?: (scene: {
188 route: NavigationRoute;
189 }) => void;
190 tabBarPosition?: 'top' | 'bottom';
191 screenProps: unknown;
192 navigation: NavigationTabProp;
193};
194export declare type NavigationCommonTabOptions = {
195 title?: string;
196 tabBarLabel?: React.ReactNode;
197 tabBarVisible?: boolean;
198 tabBarAccessibilityLabel?: string;
199 tabBarTestID?: string;
200 tabBarIcon?: React.ReactNode | ((props: {
201 focused: boolean;
202 tintColor?: string;
203 horizontal?: boolean;
204 }) => React.ReactNode);
205 tabBarOnPress?: (props: {
206 navigation: NavigationTabProp;
207 defaultHandler: () => void;
208 }) => void;
209 tabBarOnLongPress?: (props: {
210 navigation: NavigationTabProp;
211 defaultHandler: () => void;
212 }) => void;
213};
214export declare type NavigationBottomTabOptions = NavigationCommonTabOptions & {
215 tabBarButtonComponent?: React.ComponentType<ButtonComponentProps>;
216};
217export declare type NavigationMaterialTabOptions = NavigationCommonTabOptions & {
218 tabBarButtonComponent?: React.ComponentType<any>;
219 swipeEnabled?: boolean | ((state: NavigationState) => boolean);
220};
221export declare type NavigationTabScreenProps<Params = NavigationParams, ScreenProps = unknown> = {
222 theme: SupportedThemes;
223 navigation: NavigationTabProp<NavigationRoute, Params>;
224 screenProps: ScreenProps;
225};
226export declare type NavigationMaterialTabScreenComponent<Params = NavigationParams, ScreenProps = unknown> = React.ComponentType<NavigationTabScreenProps<Params, ScreenProps>> & {
227 navigationOptions?: NavigationScreenConfig<NavigationMaterialTabOptions, NavigationTabProp<NavigationRoute, Params>, ScreenProps>;
228};
229export declare type NavigationBottomTabScreenComponent<Params = NavigationParams, ScreenProps = unknown> = React.ComponentType<NavigationTabScreenProps<Params, ScreenProps>> & {
230 navigationOptions?: NavigationScreenConfig<NavigationBottomTabOptions, NavigationTabProp<NavigationRoute, Params>, ScreenProps>;
231};
232export declare type SceneDescriptorMap = {
233 [key: string]: NavigationDescriptor<NavigationParams, NavigationBottomTabOptions | NavigationMaterialTabOptions, NavigationTabProp>;
234};
235export {};
236
\No newline at end of file