-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.tsx
41 lines (36 loc) · 1.17 KB
/
routes.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from 'react';
import { createAppContainer, createBottomTabNavigator } from 'react-navigation';
import { Entypo } from '@expo/vector-icons';
import CarsMapView from './screens/CarsMapView';
import CarsListView from './screens/CarsListView';
const TabNavigator = createBottomTabNavigator(
{
CarsListView: {
screen: (screenProps: any) => <CarsListView carsPlacemarks={screenProps.screenProps.carsPlacemarks}/>,
},
CarsMapView: {
screen: (screenProps: any) => <CarsMapView carsPlacemarks={screenProps.screenProps.carsPins}/>,
},
},
{
initialRouteName: 'CarsListView',
defaultNavigationOptions: ({ navigation }) => ({
tabBarIcon: ({ tintColor }) => {
const { routeName } = navigation.state;
let iconName;
if (routeName === 'CarsMapView') {
iconName = 'map';
} else if (routeName === 'CarsListView') {
iconName = 'list';
}
return <Entypo name={iconName} size={26} color={tintColor} />;
},
}),
tabBarOptions: {
activeTintColor: 'indigo',
inactiveTintColor: 'gray',
},
},
);
const AppContainer = createAppContainer(TabNavigator);
export default AppContainer;