@@ -16,6 +16,7 @@ module BottomTabNavigationProp = (M: {
1616};
1717
1818module Make = (M : {type params ; }) => {
19+ type nonrec route = route (M . params );
1920 module Navigation =
2021 BottomTabNavigationProp ({
2122 include M ;
@@ -55,9 +56,9 @@ module Make = (M: {type params;}) => {
5556
5657 type accessibilityRole = string ;
5758 type accessibilityStates = array (string );
58- type routeArgs = {route: route ( M . params ) };
59+ type routeArgs = {route};
5960 type renderIconArgs = {
60- route: route ( M . params ) ,
61+ route,
6162 focused: bool ,
6263 tintColor: string ,
6364 horizontal: bool ,
@@ -98,8 +99,7 @@ module Make = (M: {type params;}) => {
9899 ~style : ReactNative . Style . t =?,
99100 unit
100101 ) =>
101- bottomTabBarOptions =
102- "" ;
102+ bottomTabBarOptions ;
103103
104104 type tabBarLabelArgs = {
105105 focused: bool ,
@@ -123,27 +123,50 @@ module Make = (M: {type params;}) => {
123123 ~tabBarButtonComponent : React . element =?,
124124 unit
125125 ) =>
126- options =
127- "" ;
126+ options ;
128127
129128 type optionsProps = {
130129 navigation,
131- route: route ( M . params ) ,
130+ route,
132131 };
133132
134133 type optionsCallback = optionsProps => options ;
135134
136- type navigatorProps ;
135+ type navigatorProps = {
136+ initialRouteName: option (string ),
137+ screenOptions: option (optionsCallback ),
138+ _lazy: option (bool ),
139+ tabBar: option (React . component (Js . t (bottomTabBarProps ))),
140+ tabBarOptions: option (bottomTabBarOptions ),
141+ };
142+ 143+ type renderCallbackProp = {
144+ navigation,
145+ route,
146+ };
137147
138- type screenProps ;
148+ type screenProps (' params ) = {
149+ name: string,
150+ options: option(optionsCallback),
151+ initialParams: option('params),
152+ component:
153+ option(
154+ React . component({
155+ .
156+ "navigation" : navigation,
157+ "route" : route,
158+ }),
159+ ),
160+ children: option(renderCallbackProp => React . element),
161+ };
139162
140163 [@ bs . module "@react-navigation/bottom-tabs" ]
141164 external make :
142165 unit =>
143166 {
144167 .
145168 "Navigator ": navigatorProps => React . element,
146- "Screen ": screenProps => React . element,
169+ "Screen ": screenProps( M . params) => React.element,
147170 } =
148171 "createBottomTabNavigator" ;
149172
@@ -159,12 +182,25 @@ module Make = (M: {type params;}) => {
159182 ~component : React . component ({
160183 .
161184 "navigation": navigation ,
162- "route": route ( M . params ) ,
185+ "route": route ,
163186 }),
164187 unit
165188 ) =>
166- screenProps =
167- "" ;
189+ screenProps (M . params );
190+ let make = bottomTabs## "Screen" ;
191+ };
192+ 193+ module ScreenWithCallback = {
194+ [@ bs . obj ]
195+ external makeProps :
196+ (
197+ ~name : string ,
198+ ~options : optionsCallback =?,
199+ ~initialParams : M . params =?,
200+ ~children : renderCallbackProp => React . element ,
201+ unit
202+ ) =>
203+ screenProps (M . params );
168204 let make = bottomTabs## "Screen" ;
169205 };
170206
@@ -180,8 +216,7 @@ module Make = (M: {type params;}) => {
180216 ~tabBarOptions : bottomTabBarOptions =?,
181217 unit
182218 ) =>
183- navigatorProps =
184- "" ;
219+ navigatorProps ;
185220
186221 let make = bottomTabs## "Navigator" ;
187222 };
0 commit comments