@@ -92,57 +92,67 @@ type contentComponentProps = {
92
92
93
93
type drawerStatus = [# "open" | #closed ]
94
94
95
+ type navigatorProps = {
96
+ id ?: string ,
97
+ initialRouteName ?: string ,
98
+ screenOptions ?: screenOptionsParams => options ,
99
+ backBehavior ?: backBehavior ,
100
+ defaultStatus ?: drawerStatus ,
101
+ detachInactiveScreens ?: bool ,
102
+ useLegacyImplementation ?: bool ,
103
+ drawerContent ?: React .component <contentComponentProps >,
104
+ layout ?: layoutNavigatorParams => React .element ,
105
+ children ?: React .element ,
106
+ }
107
+
108
+ type screenProps <'params > = {
109
+ name : string ,
110
+ navigationKey ?: string ,
111
+ options ?: screenOptionsParams => options ,
112
+ initialParams ?: 'params ,
113
+ getId ?: getIdOptions ,
114
+ component ?: React .component <screenProps >,
115
+ getComponent ?: unit => React .component <screenProps >,
116
+ children ?: screenProps => React .element ,
117
+ }
118
+
119
+ type groupProps = {
120
+ navigationKey ?: string ,
121
+ screenOptions ?: screenOptionsParams => options ,
122
+ }
123
+
95
124
module type NavigatorModule = {
96
125
module Navigator : {
97
- @react.component
98
- let make : (
99
- ~id : string = ?,
100
- ~initialRouteName : string = ?,
101
- ~screenOptions : screenOptionsParams => options = ?,
102
- ~backBehavior : backBehavior = ?,
103
- ~defaultStatus : drawerStatus = ?,
104
- ~detachInactiveScreens : bool = ?,
105
- ~useLegacyImplementation : bool = ?,
106
- ~drawerContent : React .component <contentComponentProps >= ?,
107
- ~layout : layoutNavigatorParams => React .element = ?,
108
- ~children : React .element = ?,
109
- ) => React .element
126
+ let make : React .component <navigatorProps >
110
127
}
111
128
112
129
module Screen : {
113
- @react.component
114
- let make : (
115
- ~name : string ,
116
- ~navigationKey : string = ?,
117
- ~options : screenOptionsParams => options = ?,
118
- ~initialParams : 'params = ?,
119
- ~getId : getIdOptions => option <string >= ?,
120
- ~component : React .component <screenProps >= ?,
121
- ~getComponent : unit => React .component <screenProps >= ?,
122
- ~children : screenProps => React .element = ?,
123
- ) => React .element
130
+ let make : React .component <screenProps <'params >>
124
131
}
125
132
126
133
module Group : {
127
- @react.component
128
- let make : (
129
- ~navigationKey : string = ?,
130
- ~screenOptions : screenOptionsParams => options = ?,
131
- ) => React .element
134
+ let make : React .component <groupProps >
132
135
}
133
136
}
134
137
135
- type navigatorModule
136
-
137
- %%private (
138
+ module Make = (): NavigatorModule => {
138
139
@module ("@react-navigation/drawer" )
139
- external createDrawerNavigator : unit => navigatorModule = "createDrawerNavigator"
140
+ external createDrawerNavigator : unit => { .. } = "createDrawerNavigator"
140
141
141
- @module ("./Interop" )
142
- external adaptNavigatorModule : navigatorModule => module (NavigatorModule ) = "adaptNavigatorModule"
143
- )
142
+ let internal = createDrawerNavigator ()
144
143
145
- module Make = () => unpack (createDrawerNavigator ()-> adaptNavigatorModule )
144
+ module Navigator = {
145
+ let make = internal ["Navigator" ]
146
+ }
147
+
148
+ module Screen = {
149
+ let make = internal ["Screen" ]
150
+ }
151
+
152
+ module Group = {
153
+ let make = internal ["Group" ]
154
+ }
155
+ }
146
156
147
157
module Navigation = {
148
158
@send
0 commit comments