Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.

Commit

Permalink
refmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vnovick committed Dec 30, 2018
1 parent 8b4b8f2 commit aaf0f84
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion example/src/Tabs.re
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module Settings = {
Styles.settingsContainer,
])}>
<View> <Text style=Styles.titile> {str("Settings")} </Text> </View>
<Button onPress={() => navigation.navigate("Profile")} title="info"/>
<Button onPress={() => navigation.navigate("Profile")} title="info" />
</SafeAreaView>,
};
};
29 changes: 13 additions & 16 deletions src/TabNavigator.re
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,13 @@ module type TabConfig = {
let containerName: string;
let tabBarOptions: tabBarOptions;
let getTab:
(tabs,navigation) => (Js.Dict.key, unit => ReasonReact.reactElement, screenOptions);
(tabs, navigation) =>
(Js.Dict.key, unit => ReasonReact.reactElement, screenOptions);
};

module Create = (Config: TabConfig) => {

[@bs.deriving abstract]
type navigatorConfig = {initialRouteName: string};


[@bs.deriving abstract]
type routeConfig = {
Expand All @@ -75,22 +74,21 @@ module Create = (Config: TabConfig) => {
};

module NavigationProp = {
[@bs.send] external navigate: string => unit = "navigate";

[@bs.send] external navigate: (string) => unit = "navigate";


[@bs.send] external goBack: (unit) => unit = "goBack";
[@bs.send] external goBack: unit => unit = "goBack";
};

let makeNavigationProp = () => {
navigate: routeName => NavigationProp.navigate(routeName),
goBack: () => NavigationProp.goBack(),
};
navigate: routeName => NavigationProp.navigate(routeName),
goBack: () => NavigationProp.goBack(),
};

let tabs =
Config.order
|> List.map(tab => {
let (tabname, screen, screenOptionsConfig) = Config.getTab(tab, makeNavigationProp());
let (tabname, screen, screenOptionsConfig) =
Config.getTab(tab, makeNavigationProp());
(
tabname,
routeConfig(~screen, ~navigationOptions=screenOptionsConfig),
Expand All @@ -104,9 +102,8 @@ module Create = (Config: TabConfig) => {
"tabBarOptions": Config.tabBarOptions,
};

let navigator = ReactNavigation.Tab.createBottomTabNavigator(tabs, tabBarOptions)

let make = ReactNavigation.Native.createAppContainer(navigator)

};
let navigator =
ReactNavigation.Tab.createBottomTabNavigator(tabs, tabBarOptions);

let make = ReactNavigation.Native.createAppContainer(navigator);
};

0 comments on commit aaf0f84

Please sign in to comment.