forked from callstack/react-native-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.tsx
124 lines (110 loc) · 3.08 KB
/
types.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import type {
Descriptor,
NavigationHelpers,
NavigationProp,
ParamListBase,
RouteProp,
TabActionHelpers,
TabNavigationState,
} from '@react-navigation/native';
import type { BottomNavigation } from 'react-native-paper';
export type MaterialBottomTabNavigationEventMap = {
/**
* Event which fires on tapping on the tab in the tab bar.
*/
tabPress: { data: undefined; canPreventDefault: true };
/**
* Event which fires on long pressing on the tab in the tab bar.
*/
tabLongPress: {};
};
export type MaterialBottomTabNavigationHelpers = NavigationHelpers<
ParamListBase,
MaterialBottomTabNavigationEventMap
> &
TabActionHelpers<ParamListBase>;
export type MaterialBottomTabNavigationProp<
ParamList extends ParamListBase,
RouteName extends keyof ParamList = keyof ParamList,
NavigatorID extends string | undefined = undefined
> = NavigationProp<
ParamList,
RouteName,
NavigatorID,
TabNavigationState<ParamList>,
MaterialBottomTabNavigationOptions,
MaterialBottomTabNavigationEventMap
> &
TabActionHelpers<ParamList>;
export type MaterialBottomTabScreenProps<
ParamList extends ParamListBase,
RouteName extends keyof ParamList = keyof ParamList,
NavigatorID extends string | undefined = undefined
> = {
navigation: MaterialBottomTabNavigationProp<
ParamList,
RouteName,
NavigatorID
>;
route: RouteProp<ParamList, RouteName>;
};
export type MaterialBottomTabNavigationOptions = {
/**
* Title text for the screen.
*/
title?: string;
/**
* Color of the tab bar when this tab is active. Only used when `shifting` is `true`.
*/
tabBarColor?: string;
/**
* Label text of the tab displayed in the navigation bar. When undefined, scene title is used.
*/
tabBarLabel?: string;
/**
* String referring to an icon in the `MaterialCommunityIcons` set, or a
* function that given { focused: boolean, color: string } returns a React.Node to display in the navigation bar.
*/
tabBarIcon?:
| string
| ((props: { focused: boolean; color: string }) => React.ReactNode);
/**
* Badge to show on the tab icon, can be `true` to show a dot, `string` or `number` to show text.
*/
tabBarBadge?: boolean | number | string;
/**
* Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.
*/
tabBarAccessibilityLabel?: string;
/**
* ID to locate this tab button in tests.
*/
tabBarButtonTestID?: string;
};
export type MaterialBottomTabDescriptor = Descriptor<
MaterialBottomTabNavigationOptions,
MaterialBottomTabNavigationProp<ParamListBase>,
RouteProp<ParamListBase>
>;
export type MaterialBottomTabDescriptorMap = Record<
string,
MaterialBottomTabDescriptor
>;
export type MaterialBottomTabNavigationConfig = Partial<
Omit<
React.ComponentProps<typeof BottomNavigation>,
| 'navigationState'
| 'onIndexChange'
| 'onTabPress'
| 'onTabLongPress'
| 'renderScene'
| 'renderLabel'
| 'renderIcon'
| 'getAccessibilityLabel'
| 'getBadge'
| 'getColor'
| 'getLabelText'
| 'getTestID'
| 'getLazy'
>
>;