|
import React from 'react'; |
|
import {createStackNavigator} from '@react-navigation/stack'; |
|
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; |
|
import Ionicons from 'react-native-vector-icons/Ionicons'; |
|
import color from '../core/colors'; |
|
//Screens |
|
import {ProfileScreen, AccountScreen, HomeScreen, QuizScreen} from '../screens'; |
|
|
|
// |
|
const Stack = createStackNavigator(); |
|
const Tab = createBottomTabNavigator(); |
|
|
|
//TabBarNavigation |
|
const TabNavigation = () => { |
|
return ( |
|
<Tab.Navigator |
|
screenOptions={({route}) => ({ |
|
tabBarIcon: ({focused, color, size}) => { |
|
let iconName; |
|
if (route.name === 'Home') { |
|
iconName = focused ? 'ios-search' : 'ios-search'; |
|
} else if (route.name === 'More') { |
|
iconName = focused ? 'ios-albums' : 'ios-albums'; |
|
} else if (route.name === 'Profile') { |
|
iconName = focused ? 'ios-person' : 'ios-person'; |
|
} |
|
// You can return any component that you like here! |
|
return <Ionicons name={iconName} size={size} color={color} />; |
|
}, |
|
})} |
|
tabBarOptions={{ |
|
activeTintColor: 'black', |
|
inactiveTintColor: 'gray', |
|
}}> |
|
<Tab.Screen |
|
name="Home" |
|
component={HomeScreen} |
|
options={{ |
|
tabBarLabel: 'Keşfet', |
|
}} |
|
/> |
|
<Tab.Screen |
|
name="More" |
|
component={AccountScreen} |
|
options={{ |
|
tabBarLabel: 'Bana Özel', |
|
}} |
|
/> |
|
<Tab.Screen |
|
name="Profile" |
|
component={ProfileScreen} |
|
options={{ |
|
tabBarLabel: 'Profil', |
|
}} |
|
/> |
|
</Tab.Navigator> |
|
); |
|
}; |
|
|
|
//Navigation |
|
function AppNavigator() { |
|
return ( |
|
<Stack.Navigator> |
|
<Stack.Screen |
|
name="TabNavigator" |
|
component={TabNavigation} |
|
options={{headerShown: false}} |
|
/> |
|
<Stack.Screen |
|
name="Home" |
|
component={HomeScreen} |
|
// options={{headerShown: false}} |
|
/> |
|
<Stack.Screen |
|
name="Profile" |
|
component={ProfileScreen} |
|
// options={{headerShown: false}} |
|
/> |
|
<Stack.Screen |
|
name="Account" |
|
component={AccountScreen} |
|
// options={{headerShown: false}} |
|
/> |
|
<Stack.Screen |
|
name="Quiz" |
|
component={QuizScreen} |
|
options={({route}) => ({ |
|
title: route.params.title, |
|
headerStyle: { |
|
backgroundColor: color.bg_color, |
|
}, |
|
headerTintColor: '#fff', |
|
headerTitleStyle: { |
|
fontWeight: 'bold', |
|
}, |
|
})} |
|
/> |
|
</Stack.Navigator> |
|
); |
|
} |
|
|
|
export default AppNavigator; |