-
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathNavigation.re
More file actions
49 lines (43 loc) · 1.65 KB
/
Copy pathNavigation.re
File metadata and controls
49 lines (43 loc) · 1.65 KB
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
open ReactNative;
type t;
type navigationEventPayload = {
.
"action": NavigationActions.action,
"context": string,
"type": string,
"state": NavigationState.t,
"lastState": Js.Nullable.t(NavigationState.t),
};
[@bs.val] [@bs.module "react-navigation"]
external navigationContext: React.Context.t(t) = "NavigationContext";
let useNavigation = () => React.useContext(navigationContext);
[@bs.get] external state: t => NavigationState.t = "state";
[@bs.send] external navigate: (t, string) => unit = "navigate";
[@bs.send]
external navigateWithParams: (t, string, Js.t({..})) => unit = "navigate";
[@bs.send] external goBack: t => unit = "goBack";
[@bs.send] external goBackToRoute: (t, string) => unit = "goBack";
[@bs.send] external dismiss: t => unit = "dismiss";
[@bs.send] external getParam: (t, string) => Js.nullable('a) = "getParam";
[@bs.send] external getParamWithDefault: (t, string, 'a) => 'a = "getParam";
[@bs.send]
external reset: (t, array(NavigationActions.action), int) => unit = "reset";
[@bs.send]
external addListener:
(
t,
[@bs.string] [ | `didBlur | `didFocus | `willBlur | `willFocus],
navigationEventPayload => unit
) =>
EventSubscription.t =
"addListener";
[@bs.send] external setParams: (t, Js.t('a)) => unit = "setParams";
// Stack Actions
// TODO: push, replace, ...
[@bs.send] external pop: t => unit = "pop";
[@bs.send] external popN: (t, int) => unit = "pop";
[@bs.send] external popToTop: t => unit = "popToTop";
// Drawer navigator only
[@bs.send] external openDrawer: t => unit = "openDrawer";
[@bs.send] external closeDrawer: t => unit = "closeDrawer";
[@bs.send] external toggleDrawer: t => unit = "toggleDrawer";