2019-08-07 10:24:35 +02:00
|
|
|
import * as React from 'react';
|
|
|
|
import {createMaterialBottomTabNavigator} from "react-navigation-material-bottom-tabs";
|
|
|
|
|
|
|
|
import HomeScreen from '../screens/HomeScreen';
|
|
|
|
import PlanningScreen from '../screens/PlanningScreen';
|
2019-09-28 12:01:19 +02:00
|
|
|
import ProxiwashScreen from '../screens/Proxiwash/ProxiwashScreen';
|
2019-08-07 10:24:35 +02:00
|
|
|
import ProximoMainScreen from '../screens/Proximo/ProximoMainScreen';
|
2020-01-30 17:42:11 +01:00
|
|
|
import PlanexScreen from '../screens/Websites/PlanexScreen';
|
2019-08-07 10:24:35 +02:00
|
|
|
import CustomMaterialIcon from "../components/CustomMaterialIcon";
|
2019-08-07 11:33:45 +02:00
|
|
|
import ThemeManager from "../utils/ThemeManager";
|
2019-09-12 23:02:28 +02:00
|
|
|
import AsyncStorageManager from "../utils/AsyncStorageManager";
|
2019-08-07 10:24:35 +02:00
|
|
|
|
|
|
|
const TAB_ICONS = {
|
2019-08-20 19:15:24 +02:00
|
|
|
Home: 'triangle',
|
2019-08-07 10:24:35 +02:00
|
|
|
Planning: 'calendar-range',
|
|
|
|
Proxiwash: 'washing-machine',
|
|
|
|
Proximo: 'shopping',
|
|
|
|
Planex: 'timetable',
|
|
|
|
};
|
|
|
|
|
2019-09-12 23:02:28 +02:00
|
|
|
function createMaterialBottomTabNavigatorWithInitialRoute(initialRoute: string) {
|
|
|
|
return createMaterialBottomTabNavigator({
|
|
|
|
Home: {screen: HomeScreen},
|
|
|
|
Planning: {screen: PlanningScreen,},
|
|
|
|
Proxiwash: {screen: ProxiwashScreen,},
|
|
|
|
Proximo: {screen: ProximoMainScreen,},
|
2019-11-08 03:56:29 +01:00
|
|
|
Planex: {
|
|
|
|
screen: PlanexScreen,
|
2020-01-26 17:51:15 +01:00
|
|
|
navigationOptions: ({navigation}) => {
|
2019-11-08 03:56:29 +01:00
|
|
|
const showTabBar = navigation.state && navigation.state.params ? navigation.state.params.showTabBar : true;
|
|
|
|
return {
|
|
|
|
tabBarVisible: showTabBar,
|
|
|
|
};
|
2020-01-26 17:51:15 +01:00
|
|
|
},
|
|
|
|
},
|
2019-09-12 23:02:28 +02:00
|
|
|
}, {
|
|
|
|
defaultNavigationOptions: ({navigation}) => ({
|
2020-01-26 17:51:15 +01:00
|
|
|
tabBarIcon: ({focused, tintColor}) => {
|
2019-09-12 23:02:28 +02:00
|
|
|
let icon = TAB_ICONS[navigation.state.routeName];
|
2020-01-26 17:51:15 +01:00
|
|
|
// tintColor is ignoring activeColor et inactiveColor for some reason
|
|
|
|
let color = focused ? "#f0edf6" : "#4e1108";
|
|
|
|
return <CustomMaterialIcon icon={icon} color={color}/>;
|
2019-11-08 03:56:29 +01:00
|
|
|
},
|
|
|
|
tabBarVisible: true,
|
2019-09-12 23:02:28 +02:00
|
|
|
}),
|
|
|
|
order: ['Proximo', 'Planning', 'Home', 'Proxiwash', 'Planex'],
|
|
|
|
initialRouteName: initialRoute,
|
|
|
|
activeColor: '#f0edf6',
|
|
|
|
inactiveColor: '#4e1108',
|
|
|
|
backBehavior: 'initialRoute',
|
|
|
|
barStyle: {backgroundColor: ThemeManager.getCurrentThemeVariables().brandPrimary},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export {createMaterialBottomTabNavigatorWithInitialRoute};
|
2019-08-07 10:24:35 +02:00
|
|
|
|