Created
July 21, 2020 18:15
-
-
Save alanfoandrade/204baefb2aa1b5b64326efa7e567ea31 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'react-native-gesture-handler'; | |
import React from 'react'; | |
import { TouchableOpacity } from 'react-native'; | |
import { NavigationContainer } from '@react-navigation/native'; | |
import { | |
createStackNavigator, | |
StackHeaderLeftButtonProps, | |
} from '@react-navigation/stack'; | |
import Icon from 'react-native-vector-icons/Feather'; | |
import Dashboard from '../pages/Dashboard'; | |
const Stack = createStackNavigator(); | |
const Application = createStackNavigator(); | |
const AppRoutes: React.FC = () => ( | |
<Application.Navigator | |
screenOptions={{ | |
headerTintColor: '#444', | |
headerTitleAlign: 'center', | |
headerLeftContainerStyle: { | |
marginLeft: 16, | |
}, | |
headerRightContainerStyle: { | |
marginRight: 16, | |
}, | |
}} | |
> | |
<Application.Screen | |
name="Dashboard" | |
component={Dashboard} | |
options={{ | |
title: 'DASHBOARD', | |
headerLeft: ({ tintColor }: StackHeaderLeftButtonProps) => ( | |
<TouchableOpacity onPress={navigation.navigate('Profile')}> | |
<Icon name="power" size={25} color={tintColor} /> | |
</TouchableOpacity> | |
), | |
headerRight: ({ tintColor }: StackHeaderLeftButtonProps) => ( | |
<TouchableOpacity onPress={() => navigation.navigate('Settings')}> | |
<Icon name="settings" size={25} color={tintColor} /> | |
</TouchableOpacity> | |
), | |
}} | |
/> | |
</Application.Navigator> | |
); | |
const App: React.FC = () => { | |
return ( | |
<NavigationContainer> | |
<Stack.Navigator> | |
<Stack.Screen | |
name="AppRoutes" | |
component={AppRoutes} | |
options={{ | |
headerShown: false, | |
}} | |
/> | |
</Stack.Navigator> | |
</NavigationContainer> | |
); | |
}; | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment