Skip to content

Instantly share code, notes, and snippets.

@EvanBacon
Created July 6, 2018 00:29
Show Gist options
  • Save EvanBacon/0307d37b44b0128507b42b5865ec0074 to your computer and use it in GitHub Desktop.
Save EvanBacon/0307d37b44b0128507b42b5865ec0074 to your computer and use it in GitHub Desktop.
Instagram Expo Clone Navigation
// Import React Navigation
import {
createBottomTabNavigator,
createStackNavigator,
} from 'react-navigation';
import tabBarIcon from './utils/tabBarIcon';
// Import the screens
import FeedScreen from './screens/FeedScreen';
import NewPostScreen from './screens/NewPostScreen';
import SelectPhotoScreen from './screens/SelectPhotoScreen';
// Create our main tab navigator for moving between the Feed and Photo screens
const navigator = createBottomTabNavigator(
{
// The name `Feed` is used later for accessing screens
Feed: {
// Define the component we will use for the Feed screen.
screen: FeedScreen,
navigationOptions: {
// Add a cool Material Icon for this screen
tabBarIcon: tabBarIcon('home'),
},
},
// All the same stuff but for the Photo screen
Photo: {
screen: SelectPhotoScreen,
navigationOptions: {
tabBarIcon: tabBarIcon('add-circle'),
},
},
},
{
// We want to hide the labels and set a nice 2-tone tint system for our tabs
tabBarOptions: {
showLabel: false,
activeTintColor: 'black',
inactiveTintColor: 'gray',
},
},
);
// Create the navigator that pushes high-level screens like the `NewPost` screen.
const stackNavigator = createStackNavigator({
Main: {
screen: navigator,
// Set the title for our app when the tab bar screen is present
navigationOptions: { title: 'Instaham 🐷' },
},
// This screen will not have a tab bar
NewPost: NewPostScreen,
});
// Export it as the root component
export default stackNavigator;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment