summaryrefslogtreecommitdiff
path: root/src/Main.js
blob: 4e5c1285e2e8fdcddff479dd6257484eb89be39e (plain) (blame)
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
42
43
44
45
46
47
48
49
50
51
import React, { Component } from 'react';
import { View } from 'react-native';
import { connect } from 'redux-su';
import IconComponent from 'react-native-vector-icons/Ionicons';
import Login from './Components/Login';
import Map from './Components/Map';
import PortalPanel from './Components/PortalPanel';
import { createStackNavigator, createBottomTabNavigator, createAppContainer } from 'react-navigation';
import Settings from './Components/Settings';

const MapNavigator = createStackNavigator({
  Map: {
    screen: Map,
    navigationOptions: {
      header: null,
    }
  },
  Portal: {
    screen: PortalPanel,
  },
});

const AppNavigator = createBottomTabNavigator({
  Map: {
    screen: MapNavigator,
    navigationOptions: {
      tabBarLabel: 'Карта',
      tabBarIcon: ({tintColor}) => <IconComponent name={'ios-map'} size={25} color={tintColor} />
    }
  },
  Settings: {
    screen: Settings,
    navigationOptions: {
      tabBarLabel: 'Настройки',
      tabBarIcon: ({tintColor}) => <IconComponent name={'ios-settings'} size={25} color={tintColor} />
    }
  }
})

const AppContainer = createAppContainer(AppNavigator)
class App extends Component {
  render() {
    return (
      <View style={{ flex: 1 }}>
        {this.props.auth.user ? <AppContainer /> : <Login />}
      </View>
    );
  }
}

export default connect({ 'auth': 'auth' }, {})(App)