|
|
@ -1,14 +1,16 @@ |
|
|
|
import React from 'react'; |
|
|
|
import React from 'react'; |
|
|
|
import { View, StyleSheet } from 'react-native'; |
|
|
|
import { View, StatusBar } from 'react-native'; |
|
|
|
import { CommonActions } from '@react-navigation/native'; |
|
|
|
import { CommonActions } from '@react-navigation/native'; |
|
|
|
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; |
|
|
|
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; |
|
|
|
import { BottomNavigation } from 'react-native-paper'; |
|
|
|
import { BottomNavigation } from 'react-native-paper'; |
|
|
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; |
|
|
|
import Icon from 'react-native-vector-icons/AntDesign'; |
|
|
|
|
|
|
|
|
|
|
|
import HomeScreen from '../screens/Home'; |
|
|
|
import HomeScreen from '../screens/Home'; |
|
|
|
import NotifikasiScreen from '../screens/Notification'; |
|
|
|
import NotifikasiScreen from '../screens/Notification'; |
|
|
|
import ProfileScreen from '../screens/Profile'; |
|
|
|
import ProfileScreen from '../screens/Profile'; |
|
|
|
import ServiceScreen from '../screens/Service'; |
|
|
|
import ServiceScreen from '../screens/Service'; |
|
|
|
|
|
|
|
import { colors } from '../utils/color'; |
|
|
|
|
|
|
|
|
|
|
|
const Tab = createBottomTabNavigator(); |
|
|
|
const Tab = createBottomTabNavigator(); |
|
|
|
|
|
|
|
|
|
|
|
export default function BottomTabNavigator() { |
|
|
|
export default function BottomTabNavigator() { |
|
|
@ -16,16 +18,23 @@ export default function BottomTabNavigator() { |
|
|
|
<Tab.Navigator |
|
|
|
<Tab.Navigator |
|
|
|
screenOptions={{ |
|
|
|
screenOptions={{ |
|
|
|
headerShown: false, |
|
|
|
headerShown: false, |
|
|
|
tabBarActiveBackgroundColor: '#1C1B40', |
|
|
|
|
|
|
|
tabBarStyle: { |
|
|
|
|
|
|
|
backgroundColor: 'white', |
|
|
|
|
|
|
|
borderTopWidth: 0, |
|
|
|
|
|
|
|
elevation: 8, |
|
|
|
|
|
|
|
height: 60, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}} |
|
|
|
}} |
|
|
|
|
|
|
|
screenListeners={({ route, navigation }) => ({ |
|
|
|
|
|
|
|
focus: () => { |
|
|
|
|
|
|
|
if (route.name === 'Home') { |
|
|
|
|
|
|
|
StatusBar.setBackgroundColor(colors.blue); |
|
|
|
|
|
|
|
StatusBar.setBarStyle('light-content'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
StatusBar.setBackgroundColor('white'); |
|
|
|
|
|
|
|
StatusBar.setBarStyle('dark-content'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
})} |
|
|
|
tabBar={({ navigation, state, descriptors, insets }) => ( |
|
|
|
tabBar={({ navigation, state, descriptors, insets }) => ( |
|
|
|
<BottomNavigation.Bar |
|
|
|
<BottomNavigation.Bar |
|
|
|
|
|
|
|
activeIndicatorStyle={{ |
|
|
|
|
|
|
|
backgroundColor: colors.semiBlue, |
|
|
|
|
|
|
|
}} |
|
|
|
navigationState={state} |
|
|
|
navigationState={state} |
|
|
|
safeAreaInsets={insets} |
|
|
|
safeAreaInsets={insets} |
|
|
|
onTabPress={({ route, preventDefault }) => { |
|
|
|
onTabPress={({ route, preventDefault }) => { |
|
|
@ -44,14 +53,21 @@ export default function BottomTabNavigator() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
}} |
|
|
|
renderIcon={({ route, focused, color }) => { |
|
|
|
renderIcon={({ route, focused }) => { |
|
|
|
const { options } = descriptors[route.key]; |
|
|
|
const { options } = descriptors[route.key]; |
|
|
|
if (options.tabBarIcon) { |
|
|
|
if (options.tabBarIcon) { |
|
|
|
return options.tabBarIcon({ focused, color: '#1C1B40', size: 24 }); |
|
|
|
return options.tabBarIcon({ focused, color: colors.blue, size: 24 }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
}} |
|
|
|
}} |
|
|
|
|
|
|
|
renderIndicator={({ route, focused }) => { |
|
|
|
|
|
|
|
if (focused) { |
|
|
|
|
|
|
|
return <View style={{ height: 4, backgroundColor: colors.blue }} />; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
|
|
|
|
getLabelText={({ route }) => { |
|
|
|
getLabelText={({ route }) => { |
|
|
|
const { options } = descriptors[route.key]; |
|
|
|
const { options } = descriptors[route.key]; |
|
|
|
const label = |
|
|
|
const label = |
|
|
@ -63,9 +79,10 @@ export default function BottomTabNavigator() { |
|
|
|
|
|
|
|
|
|
|
|
return label; |
|
|
|
return label; |
|
|
|
}} |
|
|
|
}} |
|
|
|
style={{ backgroundColor: 'white', borderTopWidth: 0, elevation: 8, }} |
|
|
|
style={{ backgroundColor: colors.pureWhite, borderTopWidth: 0, elevation: 8 }} |
|
|
|
labeled={false} |
|
|
|
labeled={false} |
|
|
|
compact={true} |
|
|
|
compact={true} |
|
|
|
|
|
|
|
activeColor={colors.beanRed} |
|
|
|
/> |
|
|
|
/> |
|
|
|
)} |
|
|
|
)} |
|
|
|
> |
|
|
|
> |
|
|
@ -74,7 +91,7 @@ export default function BottomTabNavigator() { |
|
|
|
component={HomeScreen} |
|
|
|
component={HomeScreen} |
|
|
|
options={{ |
|
|
|
options={{ |
|
|
|
tabBarLabel: 'Beranda', |
|
|
|
tabBarLabel: 'Beranda', |
|
|
|
tabBarIcon: ({ color, size }) => { |
|
|
|
tabBarIcon: ({ color, size, focused }) => { |
|
|
|
return <Icon name="home" size={size} color={color} />; |
|
|
|
return <Icon name="home" size={size} color={color} />; |
|
|
|
}, |
|
|
|
}, |
|
|
|
}} |
|
|
|
}} |
|
|
@ -84,18 +101,8 @@ export default function BottomTabNavigator() { |
|
|
|
component={ServiceScreen} |
|
|
|
component={ServiceScreen} |
|
|
|
options={{ |
|
|
|
options={{ |
|
|
|
tabBarLabel: 'Service', |
|
|
|
tabBarLabel: 'Service', |
|
|
|
tabBarIcon: ({ color, size }) => { |
|
|
|
tabBarIcon: ({ color, size, focused }) => { |
|
|
|
return <Icon name="view-list" size={size} color={color} />; |
|
|
|
return <Icon name={focused ? "appstore1" : "appstore-o"} size={size} color={color} />; |
|
|
|
}, |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<Tab.Screen |
|
|
|
|
|
|
|
name="Notifikasi" |
|
|
|
|
|
|
|
component={NotifikasiScreen} |
|
|
|
|
|
|
|
options={{ |
|
|
|
|
|
|
|
tabBarLabel: 'Notifikasi', |
|
|
|
|
|
|
|
tabBarIcon: ({ color, size }) => { |
|
|
|
|
|
|
|
return <Icon name="bell" size={size} color={color} />; |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
@ -105,7 +112,7 @@ export default function BottomTabNavigator() { |
|
|
|
options={{ |
|
|
|
options={{ |
|
|
|
tabBarLabel: 'Profil', |
|
|
|
tabBarLabel: 'Profil', |
|
|
|
tabBarIcon: ({ color, size }) => { |
|
|
|
tabBarIcon: ({ color, size }) => { |
|
|
|
return <Icon name="account-settings" size={size} color={color} />; |
|
|
|
return <Icon name="user" size={size} color={color} />; |
|
|
|
}, |
|
|
|
}, |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|