-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathMaterialBottomTabs.res
117 lines (96 loc) · 2.6 KB
/
MaterialBottomTabs.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
// https://reactnavigation.org/docs/material-bottom-tab-navigator
open Core
open ReactNative
type tabBarIconOptions = {
focused: bool,
color: string,
}
module TabBarBadge = {
type t
external boolean: bool => t = "%identity"
external int: int => t = "%identity"
external string: string => t = "%identity"
}
type tabBarLabelArgs = {
focused: bool,
color: string,
children: string,
}
@unboxed
type tabBarLabel = String(string) | Function(tabBarLabelArgs => React.element)
type options = {
title?: string,
tabBarIcon?: tabBarIconOptions => React.element,
tabBarColor?: Color.t,
tabBarLabel?: tabBarLabel,
tabBarBadge?: TabBarBadge.t,
tabBarAccessibilityLabel?: string,
tabBarTestID?: string,
}
type navigatorProps = {
id?: string,
initialRouteName?: string,
screenOptions?: screenOptionsParams => options,
backBehavior?: backBehavior,
shifting?: bool,
labeled?: bool,
activeColor?: Color.t,
inactiveColor?: Color.t,
barStyle?: Style.t,
layout?: layoutNavigatorParams => React.element,
children: React.element,
}
type screenProps<'params> = {
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,
}
type groupProps = {
navigationKey?: string,
screenOptions?: screenOptionsParams => options,
}
module type NavigatorModule = {
module Navigator: {
let make: React.component<navigatorProps>
}
module Screen: {
let make: React.component<screenProps<'params>>
}
module Group: {
let make: React.component<groupProps>
}
}
module Make = (): NavigatorModule => {
@module("@react-navigation/material-bottom-tabs")
external createMaterialBottomTabNavigator: unit => {..} = "createMaterialBottomTabNavigator"
let internal = createMaterialBottomTabNavigator()
module Navigator = {
let make = internal["Navigator"]
}
module Screen = {
let make = internal["Screen"]
}
module Group = {
let make = internal["Group"]
}
}
module Navigation = {
@send
external setOptions: (navigation, options) => unit = "setOptions"
@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"
}