-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathBottomTabs.res
152 lines (134 loc) · 4.08 KB
/
BottomTabs.res
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// https://reactnavigation.org/docs/bottom-tab-navigator
open Core
open Elements
open ReactNative
type tabBarLabelPosition = [#"below-icon" | #"beside-icon"]
type tabBarPosition = [#bottom | #top | #left | #right]
type tabBarVariant = [#uikit | #material]
type animation = [
| #fade
| #shift
| #none
]
type tabBarIconOptions = {
focused: bool,
color: string,
}
module TabBarBadge = {
type t
external int: int => t = "%identity"
external string: string => t = "%identity"
}
type rec options = {
title?: string,
tabBarLabel?: string,
tabBarShowLabel?: bool,
tabBarLabelPosition?: tabBarLabelPosition,
tabBarLabelStyle?: Style.t,
tabBarIcon?: tabBarIconOptions => React.element,
tabBarIconStyle?: Style.t,
tabBarBadge?: string,
tabBarBadgeStyle?: Style.t,
tabBarAccessibilityLabel?: string,
tabBarButtonTestID?: string,
tabBarButton?: unit => React.element, // TODO: props
tabBarActiveTintColor?: string,
tabBarInactiveTintColor?: string,
tabBarActiveBackgroundColor?: string,
tabBarInactiveBackgroundColor?: string,
tabBarHideOnKeyboard?: bool,
tabBarItemStyle?: Style.t,
tabBarStyle?: Style.t,
tabBarBackground?: unit => React.element,
tabBarPosition?: tabBarPosition,
tabBarVariant?: tabBarVariant,
sceneStyle?: Style.t,
\"lazy"?: bool,
popToTopOnBlur?: bool,
freezeOnBlur?: bool,
header?: headerParams => React.element,
headerShown?: bool,
animation?: animation,
// Header props from https://reactnavigation.org/docs/elements#header
headerTitle?: Header.headerTitle,
headerTitleAlign?: Header.headerTitleAlign,
headerTitleAllowFontScaling?: bool,
headerTitleStyle?: Style.t,
headerTitleContainerStyle?: Style.t,
headerLeft?: Header.headerLeftProps => React.element,
headerLeftLabelVisible?: bool,
headerLeftContainerStyle?: Style.t,
headerRight?: Header.headerRightProps => React.element,
headerRightContainerStyle?: Style.t,
headerPressColor?: Color.t,
headerPressOpacity?: float,
headerTintColor?: Color.t,
headerBackground?: Header.headerBackgroundOptions => React.element,
headerBackgroundContainerStyle?: Style.t,
headerTransparent?: bool,
headerStyle?: Style.t,
headerShadowVisible?: bool,
headerStatusBarHeight?: Style.size,
}
and headerParams = {
navigation: navigation,
route: route,
options: options,
layout: layout,
}
module type NavigatorModule = {
module Navigator: {
@react.component
let make: (
~id: string=?,
~initialRouteName: string=?,
~screenOptions: screenOptionsParams => options=?,
~backBehavior: backBehavior=?,
~detachInactiveScreens: bool=?,
~tabBar: unit => React.element=?,
~layout: layoutNavigatorParams => React.element=?,
~children: React.element,
) => React.element
}
module Screen: {
@react.component
let make: (
~name: string,
~navigationKey: string=?,
~options: screenOptionsParams => options=?,
~initialParams: 'params=?,
~getId: getIdOptions => option<string>=?,
~component: React.component<screenProps>=?,
~getComponent: unit => React.component<screenProps>=?,
~children: screenProps => React.element=?,
) => React.element
}
module Group: {
@react.component
let make: (
~navigationKey: string=?,
~screenOptions: screenOptionsParams => options=?,
) => React.element
}
}
type navigatorModule
%%private(
@module("@react-navigation/bottom-tabs")
external createBottomTabNavigator: unit => navigatorModule = "createBottomTabNavigator"
@module("./Interop")
external adaptNavigatorModule: navigatorModule => module(NavigatorModule) = "adaptNavigatorModule"
)
module Make = () => unpack(createBottomTabNavigator()->adaptNavigatorModule)
module Navigation = {
@send external jumpTo: (navigation, string, ~params: 'params=?) => unit = "jumpTo"
@deprecated("Use `jumpTo` with `~params` instead") @send
external jumpToWithParams: (navigation, string, 'params) => unit = "jumpTo"
@send
external addEventListener: (
navigation,
@string
[
| #tabPress(navigationEvent<unit> => unit)
],
) => unsubscribe = "addListener"
}