-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathNative.res
165 lines (135 loc) · 4.13 KB
/
Native.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
153
154
155
156
157
158
159
160
161
162
163
164
165
type themeColors = {
primary: string,
background: string,
card: string,
text: string,
border: string,
notification: string,
}
type themeFonts = {
regular: ReactNative.Style.t,
medium: ReactNative.Style.t,
bold: ReactNative.Style.t,
heavy: ReactNative.Style.t,
}
type theme = {
dark: bool,
colors: themeColors,
fonts: themeFonts,
}
@module("@react-navigation/native")
external defaultTheme: theme = "DefaultTheme"
@module("@react-navigation/native")
external darkTheme: theme = "DarkTheme"
@module("@react-navigation/native")
external useTheme: unit => theme = "useTheme"
module Linking = {
type rec config = {
path?: string,
exact?: bool,
initialRouteName?: string,
screens?: screens,
}
and screens = dict<config>
type t = {
enabled?: bool,
prefixes: array<string>,
config?: config,
}
}
module NavigationIndependentTree = {
@module("@react-navigation/native") @react.component
external make: (~children: React.element) => React.element = "NavigationIndependentTree"
}
module NavigationContainer = {
type state = Js.Json.t
type navigationState = state => unit
@module("@react-navigation/native") @react.component
external make: (
~ref: ReactNative.Ref.t<Core.navigation>=?,
~initialState: state=?,
~onStateChange: navigationState=?,
~onReady: unit => unit=?,
~theme: theme=?,
~linking: Linking.t=?,
~children: React.element,
~navigationInChildEnabled: bool=?,
) => React.element = "NavigationContainer"
@send
external isReady: Core.navigation => bool = "isReady"
@send
external resetRoot: (Core.navigation, Core.navigationState) => unit = "resetRoot"
@send
external getRootState: Core.navigation => Js.nullable<Core.navigationState> = "getRootState"
@send
external getCurrentRoute: Core.navigation => Js.nullable<Core.route> = "getCurrentRoute"
}
@module("@react-navigation/native")
external useNavigation: unit => Js.nullable<Core.navigation> = "useNavigation"
@module("@react-navigation/native")
external useRoute: unit => Js.nullable<Core.route> = "useRoute"
@module("@react-navigation/native")
external useIsFocused: unit => bool = "useIsFocused"
type focusCallback = unit => option<unit => unit>
@module("@react-navigation/native")
external useFocusEffect: focusCallback => unit = "useFocusEffect"
@module("@react-navigation/native")
external useScrollToTop: React.ref<'value> => unit = "useScrollToTop"
type serverContainer<'a> = {getCurrentOptions: option<'a>}
type location = {
pathname: string,
search: string,
}
module ServerContainer = {
@module("@react-navigation/native") @react.component
external make: (
~ref: ReactNative.Ref.t<serverContainer<'a>>=?,
~location: location=?,
~children: React.element,
) => React.element = "ServerContainer"
}
module CommonActions = {
type navigateParams
@obj
external navigateParams: (
~name: string=?,
~key: string=?,
~params: 'params=?,
unit,
) => navigateParams = ""
@module("@react-navigation/native") @scope("CommonActions")
external navigate: navigateParams => Core.action = "navigate"
@module("@react-navigation/native") @scope("CommonActions")
external goBack: unit => Core.action = "goBack"
}
@module("@react-navigation/native")
external useLinkTo: string => unit = "useLinkTo"
type linkPropsIn<'params> = {
screen?: string,
params?: 'params,
action?: Core.action,
href?: string,
}
type linkPropsOut = {
href: string,
accessibilityRole: string,
onPress: unit => unit,
}
@module("@react-navigation/native")
external useLinkProps: linkPropsIn<'params> => linkPropsOut = "useLinkProps"
type linkBuilderOut<'params> = {
buildHref: (string, 'params) => string,
buildAction: string => Core.action,
}
@module("@react-navigation/native")
external useLinkBuilder: unit => linkBuilderOut<'params> = "useLinkBuilder"
module Link = {
type props<'params> = {
...linkPropsIn<'params>,
children: React.element,
}
@module("@react-navigation/native")
external make: props<'params> => React.element = "Link"
}
@module("@react-navigation/native")
external getFocusedRouteNameFromRoute: Core.route => option<string> = "getFocusedRouteNameFromRoute"