1+ open ReactNative ;
12type t ;
23
4+ type navigationEventPayload = {
5+ .
6+ "action": NavigationActions . action ,
7+ "context": string ,
8+ "type": string ,
9+ "state": NavigationState . t ,
10+ "lastState": Js . Nullable . t (NavigationState . t ),
11+ };
12+ 313[@ bs . val ] [@ bs . module "react-navigation" ]
414external navigationContext : React . Context . t (t ) = "NavigationContext" ;
515
@@ -14,7 +24,17 @@ external navigateWithParams: (t, string, Js.t({..})) => unit = "navigate";
1424[@ bs . send ] external goBackToRoute : (t , string ) => unit = "" ;
1525[@ bs . send ] external getParam : (t , string ) => Js . nullable (' a ) = "" ;
1626[@ bs . send ] external getParamWithDefault : (t , string , ' a ) => ' a = "getParam" ;
17- // TODO: addListener, setParams, ...
27+ [@ bs . send ]
28+ external addListener :
29+ (
30+ t ,
31+ [@ bs . string ] [ | ` didBlur | ` didFocus | ` willBlur | ` willFocus ] ,
32+ navigationEventPayload => unit
33+ ) =>
34+ EventSubscription . t =
35+ "addListener" ;
36+ 37+ // TODO: setParams, ...
1838// Stack Actions
1939// TODO: push, replace, ...
2040[@ bs . send ] external pop : t => unit = "" ;
0 commit comments