Skip to content

Commit

Permalink
feat(home): open components tab when launched in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
artyorsh authored Jan 16, 2020
1 parent c6200b0 commit da851dc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/navigation/home.navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ import { HomeDrawer } from '../scenes/home/home-drawer.component';
const BottomTab = createBottomTabNavigator();
const Drawer = createDrawerNavigator();

// Can we access it from `HomeNavigator`?
/*
* When dev is true in .expo/settings.json (started via `start:dev`),
* open Components tab as default.
*/
const initialTabRoute: string = __DEV__ ? 'Components' : 'Layouts';

/*
* Can we access it from `HomeNavigator`?
*/
const ROOT_ROUTES: string[] = ['Home', 'Layouts', 'Components', 'Themes'];

const isOneOfRootRoutes = (currentRoute: RouteProp<any, any>): boolean => {
Expand All @@ -26,6 +34,7 @@ const TabBarVisibleOnRootScreenOptions = ({ route }): BottomTabNavigationOptions
const HomeTabsNavigator = (): React.ReactElement => (
<BottomTab.Navigator
screenOptions={TabBarVisibleOnRootScreenOptions}
initialRouteName={initialTabRoute}
tabBar={props => <HomeBottomNavigation {...props} />}>
<BottomTab.Screen name='Layouts' component={LayoutsNavigator}/>
<BottomTab.Screen name='Components' component={ComponentsNavigator}/>
Expand Down

0 comments on commit da851dc

Please sign in to comment.