|
import React from 'react'; |
|
import Colors from '../constants/Colors'; |
|
import { Platform } from 'react-native'; |
|
import { TouchableOpacity } from 'react-native'; |
|
import { Button, Icon} from 'react-native-elements' |
|
|
|
import { Ionicons } from '@expo/vector-icons'; |
|
import { TabNavigator, TabBarTop } from 'react-navigation'; |
|
import { NavigationActions } from 'react-navigation' |
|
import RootNavigation from './RootNavigation'; |
|
|
|
import SiteDrawer from './SiteDrawer'; |
|
import SiteControlScreen from '../screens/SiteControlScreen'; |
|
import SitePressureScreen from '../screens/SitePressureScreen'; |
|
import MainTabNavigator from './MainTabNavigator'; |
|
|
|
|
|
/* |
|
const HomeIconComponent = ({ navigation }) => ( |
|
<TouchableOpacity onPress={() => this.props.navigation.navigate('Main')}> |
|
<Icon/> |
|
</TouchableOpacity> |
|
) |
|
*/ |
|
|
|
const SiteTabInitNavigator = TabNavigator( |
|
|
|
{ |
|
SiteDrawer: { |
|
screen: SiteDrawer, |
|
navigationOptions: ({ navigation }) => ({ |
|
tabBarIcon: ({ tintColor, focused }) => ( |
|
<Ionicons focused={focused} color={tintColor} name={Platform.OS === 'ios' ? `ios-information-circle${focused ? '' : '-outline'}` : 'md-information-circle' } /> |
|
), |
|
}) |
|
}, |
|
Control: { |
|
screen: SiteControlScreen, |
|
navigationOptions: ({ navigation }) => ({ |
|
tabBarIcon: ({ tintColor, focused }) => ( |
|
<Ionicons focused={focused} color={tintColor} name={Platform.OS === 'ios' ? `ios-link${focused ? '' : '-outline'}` : 'md-link' } /> |
|
), |
|
}) |
|
}, |
|
Pressure: { |
|
screen: SitePressureScreen, |
|
navigationOptions: ({ navigation }) => ({ |
|
tabBarIcon: ({ tintColor, focused }) => ( |
|
<Ionicons focused={focused} color={tintColor} name={Platform.OS === 'ios' ? `ios-options${focused ? '' : '-outline'}` : 'md-options' } /> |
|
), |
|
}) |
|
}, |
|
|
|
Home: { |
|
screen: HomeIconComponent, |
|
navigationOptions: ({ navigation }) => ({ |
|
tabBarIcon: ({ tintColor, focused }) => ( |
|
<HomeIconComponent color={tintColor} navigation={navigation} focused={focused}/> |
|
), |
|
}) |
|
}, |
|
|
|
} |
|
) |
|
|
|
|
|
|
|
export default class SiteTabNavigator extends React.Component { |
|
|
|
constructor(props) { |
|
super(props); |
|
} |
|
|
|
backToSummary = function(){ |
|
console.log("running back to summary") |
|
const resetAction = NavigationActions.reset({index: 0, key: null, actions: [NavigationActions.navigate({ routeName: 'Main'})]}); |
|
this.props.navigate.dispatch(resetAction); |
|
/* |
|
const resetAction = NavigationActions.reset({ |
|
index: 0, |
|
actions: [NavigationActions.navigate({routeName: 'Main'})] |
|
}) |
|
this.props.navigation.dispatch(resetAction); |
|
*/ |
|
} |
|
|
|
const HomeIconComponent = ({ navigation }) => ( |
|
<TouchableOpacity onPress={this.backToSummary()}> |
|
<Icon/> |
|
</TouchableOpacity> |
|
) |
|
|
|
render(){ |
|
return ( |
|
<SiteTabInitNavigator> |
|
) |
|
} |
|
|
|
|
|
|
|
} |