@@ -30,33 +30,25 @@ module Make = (M: {type params;}) => {
3030 type animatedNode = ReactNative . Animated . Value . t ;
3131
3232 type scene = {
33- .
34- "route": route ,
35- "focused": bool ,
36- "tintColor": string ,
33+ focused: bool ,
34+ color: string ,
3735 };
3836
37+ type descriptors ;
38+ 3939 class type virtual tabBar = {
4040 pub scrollEnabled: option(bool);
41- pub bounces: option(bool);
4241 // pub navigationState: navigationState(M.params);
4342 // pub activeColor: option(string);
4443 // pub inactiveColor: option(string);
4544 pub pressColor: option(string);
4645 pub pressOpacity: option(float);
47- // pub getLabelText: scene => Js.nullable(string);
48- pub getAccessible: scene => Js.nullable(bool);
49- // pub getAccessibilityLabel: scene => Js.nullable(string);
50- // pub getTestID: scene => Js.nullable(string);
5146 // TODO: render: https://github.com/react-native-community/react-native-tab-view/blob/64e03bf14b0fac9c3bccd684bf31a04ecf19c50d/src/TabBar.tsx#L38-L51
52- // pub onTabPress: option(scene => unit);
53- // pub onTabLongPress: option(scene => unit);
5447 pub tabStyle: option(ReactNative.Style.t);
5548 pub indicatorStyle: option(ReactNative.Style.t);
56- pub indicatorContainerStyle: option(ReactNative.Style.t);
5749 pub labelStyle: option(ReactNative.Style.t);
58- pub contentContainerStyle: option(ReactNative.Style.t);
5950 pub style: option(ReactNative.Style.t);
51+ pub renderIndicator: option(React.component({. "route": route}));
6052 };
6153
6254 class type virtual materialTopTabBarOptions = {
@@ -67,7 +59,6 @@ module Make = (M: {type params;}) => {
6759 pub iconStyle: option(ReactNative . Style . t);
6860 pub showLabel: option(bool);
6961 pub showIcon: option(bool);
70- pub upperCaseLabel: option(bool);
7162 pub allowFontScaling: option(bool);
7263 };
7364
@@ -81,21 +72,11 @@ module Make = (M: {type params;}) => {
8172 constraint 'self = # materialTopTabBarOptions;
8273 pub state: navigationState(M . params);
8374 pub navigation: navigation;
84- // pub getLabelText: routeOptions => ...;
85- pub getAccessibilityLabel: routeOptions => Js . nullable(string);
86- pub getTestID: routeOptions => Js . nullable(string);
87- pub onTabPress:
88- {
89- .
90- "route" : route,
91- [@ bs . meth ] "preventDefault" : unit => unit,
92- } =>
93- unit;
94- pub onTabLongPress: routeOptions => unit;
95- pub tabBarPosition: string; // `top | `bottom
96- // SceneRendererProps
75+ pub descriptors: descriptors;
76+ // SceneRendererProps from react-native-tab-view
9777 pub layout: layout;
9878 pub position: animatedNode;
79+ pub jumpTo: string => unit;
9980 };
10081
10182 [@ bs . obj ]
@@ -106,19 +87,15 @@ module Make = (M: {type params;}) => {
10687 ~iconStyle : ReactNative . Style . t =?,
10788 ~showLabel : bool =?,
10889 ~showIcon : bool =?,
109- ~upperCaseLabel : bool =?,
11090 ~allowFontScaling : bool =?,
11191 ~scrollEnabled : bool =?,
112- ~bounces : bool =?,
11392 ~pressColor : string =?,
11493 ~pressOpacity : float =?,
115- ~getAccessible : Js . nullable (bool )=?,
11694 ~tabStyle : ReactNative . Style . t =?,
11795 ~indicatorStyle : ReactNative . Style . t =?,
118- ~indicatorContainerStyle : ReactNative . Style . t =?,
11996 ~labelStyle : ReactNative . Style . t =?,
120- ~contentContainerStyle : ReactNative . Style . t =?,
12197 ~style : ReactNative . Style . t =?,
98+ ~renderIndicator : React . component ({. "route": route })=?,
12299 unit
123100 ) =>
124101 materialTopTabBarOptions ;
@@ -133,7 +110,6 @@ module Make = (M: {type params;}) => {
133110 ~tabBarIcon : scene => React . element =?,
134111 ~tabBarAccessibilityLabel : string =?,
135112 ~tabBarTestID : string =?,
136- ~tabBarVisible : bool =?,
137113 unit
138114 ) =>
139115 options ;
@@ -148,16 +124,19 @@ module Make = (M: {type params;}) => {
148124 type navigatorProps = {
149125 initialRouteName: option (string ),
150126 screenOptions: option (optionsCallback ),
151- lazyPlaceholderComponent: option (React . component ({. "route": route })),
152- tabBar: option (React . component (Js . t (materialTopTabBarProps ))),
127+ _lazy: option (bool ),
128+ lazyPreloadDistance: option (int ),
129+ lazyPlaceholder: option (React . component ({. "route": route })),
130+ tabBar: option (Js . t (materialTopTabBarProps ) => React . element ),
153131 tabBarOptions: option (materialTopTabBarOptions ),
154132 tabBarPosition: option (string ),
155133 backBehavior: option (string ),
156- shifting: option (bool ),
157- labeled: option (bool ),
158- activeColor: option (string ),
159- inactiveColor: option (string ),
160- barStyle: option (ReactNative . Style . t ),
134+ removeClippedSubviews: option (bool ),
135+ keyboardDismissMode: option (string ),
136+ swipeEnabled: option (bool ),
137+ swipeVelocityImpact: option (float ),
138+ sceneContainerStyle: option (ReactNative . Style . t ),
139+ style: option (ReactNative . Style . t ),
161140 };
162141
163142 type renderCallbackProp = {
@@ -227,14 +206,66 @@ module Make = (M: {type params;}) => {
227206 ~initialRouteName : string =?,
228207 ~screenOptions : optionsCallback =?,
229208 ~children : React . element ,
230- ~lazyPlaceholderComponent : React . component ({. "route": route })=?,
231- ~tabBar : React . component (Js . t (materialTopTabBarProps ))=?,
209+ ~backBehavior : [@ bs . string ] [
210+ | ` initialRoute
211+ | ` order
212+ | ` history
213+ | ` none
214+ ]
215+ =?,
216+ ~_lazy : bool =?,
217+ ~lazyPreloadDistance : int =?,
218+ ~lazyPlaceholder : React . component ({. "route": route })=?,
219+ ~tabBar : Js . t (materialTopTabBarProps ) => React . element =?,
232220 ~tabBarOptions : materialTopTabBarOptions =?,
233221 ~tabBarPosition : [@ bs . string ] [ | ` top | ` bottom ] =?,
222+ ~removeClippedSubviews : bool =?,
223+ ~keyboardDismissMode : [@ bs . string ] [
224+ | ` auto
225+ | [@ bs . as "on-drag" ] ` onDrag
226+ | ` none
227+ ]
228+ =?,
229+ ~swipeEnabled : bool =?,
230+ ~swipeVelocityImpact : float =?,
231+ ~sceneContainerStyle : ReactNative . Style . t =?,
232+ ~style : ReactNative . Style . t =?,
234233 unit
235234 ) =>
236235 navigatorProps ;
237236
238237 let make = materialTopTabs## "Navigator" ;
239238 };
239+ 240+ module MaterialTopTabBar = {
241+ [@ bs . module "@react-navigation/material-top-tabs" ] [@ react . component ]
242+ external make :
243+ (
244+ ~state : navigationState (M . params ),
245+ ~navigation : navigation ,
246+ ~descriptors : descriptors ,
247+ // SceneRendererProps from react-native-tab-view
248+ ~layout : layout ,
249+ ~position : animatedNode ,
250+ ~jumpTo : string => unit ,
251+ // materialTopTabBarOptions
252+ ~activeTintColor : string =?,
253+ ~inactiveTintColor : string =?,
254+ ~iconStyle : ReactNative . Style . t =?,
255+ ~showLabel : bool =?,
256+ ~showIcon : bool =?,
257+ ~allowFontScaling : bool =?,
258+ ~scrollEnabled : bool =?,
259+ ~pressColor : string =?,
260+ ~pressOpacity : float =?,
261+ ~tabStyle : ReactNative . Style . t =?,
262+ ~indicatorStyle : ReactNative . Style . t =?,
263+ ~labelStyle : ReactNative . Style . t =?,
264+ ~style : ReactNative . Style . t =?,
265+ ~renderIndicator : React . component ({. "route": route })=?,
266+ unit
267+ ) =>
268+ React . element =
269+ "MaterialTopTabBar" ;
270+ };
240271};
0 commit comments