Skip to content

Commit

Permalink
Migrate to React Navigation v5
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-poe committed Jan 18, 2020
1 parent ae28955 commit d9bc074
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 50 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"dependencies": {
"@expo/vector-icons": "^10.0.6",
"@react-native-community/masked-view": "0.1.5",
"@react-navigation/bottom-tabs": "^5.0.0-alpha.34",
"@react-navigation/native": "^5.0.0-alpha.27",
"@react-navigation/stack": "^5.0.0-alpha.58",
"axios": "^0.19.1",
Expand Down
2 changes: 1 addition & 1 deletion src/navigation/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const HomeNavigator = () => (

const HomeIcon = {
tabBarIcon: ({ tintColor }) => (
<Icon name="ios-home" size={40} color={tintColor} />
<Icon name="ios-home" size={32} color={tintColor} />
),
};

Expand Down
72 changes: 23 additions & 49 deletions src/navigation/RootNavigator.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
import React from 'react';
import { NavigationNativeContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { createStackNavigator } from '@react-navigation/stack';
import { HomeNavigator, HomeIcon } from './Home';
import { colors } from '../components/common/theme';

const Stack = createStackNavigator();
import { HomeNavigator, HomeIcon } from './Home';

const RootNavigator = () => (
<NavigationNativeContainer>
<Stack.Navigator
headerMode="none"
screenOptions={{
gestureEnabled: false,
}}
>
<Stack.Screen component={HomeNavigator} />
</Stack.Navigator>
</NavigationNativeContainer>
);
const Tab = createBottomTabNavigator();
const Stack = createStackNavigator();

/* const TabBarNavigator = createBottomTabNavigator(
{
Home: { screen: HomeNavigator },
},
{
initialRouteName: 'Home',
defaultNavigationOptions: () => HomeIcon,
tabBarOptions: {
const TabNavigator = () => (
<Tab.Navigator
screenOptions={() => HomeIcon}
tabBarOptions={{
inactiveTintColor: colors.mediumGray,
showIcon: true,
showLabel: false,
Expand All @@ -38,35 +24,23 @@ const RootNavigator = () => (
height: 70,
backgroundColor: colors.white,
},
},
}
}}
>
<Tab.Screen component={HomeNavigator} />
</Tab.Navigator>
);

const MainNavigator = createStackNavigator(
{
Home: { screen: TabBarNavigator },
},
{
initialRouteName: 'Home',
headerMode: 'none',
cardStyle: { shadowColor: 'transparent' },
}
const RootNavigator = () => (
<NavigationNativeContainer>
<Stack.Navigator
headerMode="none"
screenOptions={{
gestureEnabled: false,
}}
>
<Stack.Screen component={TabNavigator} />
</Stack.Navigator>
</NavigationNativeContainer>
);

const RootNavigator = createAppContainer(
createStackNavigator(
{
Main: { screen: MainNavigator },
},
{
headerMode: 'none',
cardStyle: { shadowColor: 'transparent' },
mode: 'modal',
defaultNavigationOptions: {
gesturesEnabled: false,
},
}
)
); */

export default RootNavigator;

0 comments on commit d9bc074

Please sign in to comment.