This repository was archived by the owner on May 8, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +27
-19
lines changed Expand file tree Collapse file tree 6 files changed +27
-19
lines changed Original file line number Diff line number Diff line change 1
1
let stack = StackExample . render;
2
- let tab = TabExample . render;
2
+ /* let tab = TabExample.render; */
3
3
let drawer = DrawerExample . render;
4
4
5
5
let switchNavigator = SwitchExample . render;
6
6
7
- let app = drawer ;
7
+ let app = stack ;
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ module Stack =
35
35
<Screen navigation text= {"Browsing profile of: " ++ userId} />,
36
36
screenOptions(~title= "Hello " ++ userId, () ),
37
37
)
38
- | TabExample => (<TabExample navigation />, screenOptions() )
38
+ | TabExample => (<TabExample />, screenOptions() )
39
39
};
40
40
});
41
41
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ module Tabs =
6
6
type tabs = Config . tabs ;
7
7
type order = list (tabs );
8
8
9
+ let containerName = "TabExample" ;
10
+
9
11
let tabBarOptions =
10
12
TabNavigator . tabBarOptions(~activeTintColor= "#847" , () );
11
13
@@ -32,9 +34,4 @@ module Tabs =
32
34
};
33
35
});
34
36
35
- let render = Tabs . render;
36
-
37
- let make = (~navigation, _children) => {
38
- ... (ReasonReact . statelessComponent("TabExample ")),
39
- render: _ => Tabs . render
40
- }
37
+ let make = Tabs . make
Original file line number Diff line number Diff line change 34
34
"react-navigation" : " ^3.0.5" ,
35
35
"react-navigation-drawer" : " ^1.0.5" ,
36
36
"react-navigation-stack" : " ^1.0.5" ,
37
- "@react-navigation/core" : " ^3.0.1" ,
38
- "@react-navigation/native" : " ^3.0.3" ,
39
37
"react-navigation-tabs" : " 1.0.1" ,
40
38
"reason-react" : " ^0.5.3"
41
39
},
Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ module Stack = {
21
21
22
22
module Tab = {
23
23
[@ bs . module "react-navigation-tabs" ]
24
- external createBottomTabNavigator : (' a , ' b ) => ReasonReact . reactElement = "" ;
24
+ external createBottomTabNavigator : (' a , ' b ) => ReasonReact . reactClass = "" ;
25
25
26
26
[@ bs . module "react-navigation-tabs" ]
27
- external createMaterialTopTabNavigator : ' a => ReasonReact . reactElement = ""
27
+ external createMaterialTopTabNavigator : ' a => ReasonReact . reactClass = ""
28
28
};
29
29
30
30
module Switch = {
Original file line number Diff line number Diff line change @@ -56,12 +56,14 @@ module type TabConfig = {
56
56
type tabs ;
57
57
type order = list (tabs );
58
58
let order : order ;
59
+ let containerName : string ;
59
60
let tabBarOptions : tabBarOptions ;
60
61
let getTab :
61
62
tabs => (Js . Dict . key , navigation => ReasonReact . reactElement , screenOptions );
62
63
};
63
64
64
65
module Create = (Config : TabConfig ) => {
66
+
65
67
[@ bs . deriving abstract]
66
68
type navigatorConfig = {initialRouteName: string };
67
69
@@ -89,10 +91,21 @@ module Create = (Config: TabConfig) => {
89
91
"tabBarOptions" : Config . tabBarOptions,
90
92
};
91
93
92
- /* navigator */
93
- let navigator =
94
- ReactNavigation . Tab . createBottomTabNavigator(tabs, tabBarOptions);
94
+ let navigator = ReactNavigation . Tab . createBottomTabNavigator(tabs, tabBarOptions)
95
+
96
+ let navigatorElement = ReasonReact . createElement(navigator, [||] )
97
+
98
+ module Container = {
99
+ let component = ReasonReact . statelessComponent(Config . containerName);
100
+
101
+ let make = (_children) => {
102
+ ... component,
103
+ render: _self => navigatorElement
104
+ };
105
+ };
106
+
107
+
108
+ let make = Container . make
109
+
110
+ };
95
111
96
- /* Wrap StackNavigator with the AppContainer - temporary */
97
- let render = ReactNavigation . Native . createAppContainer(navigator);
98
- };
You can’t perform that action at this time.
0 commit comments