|
|
|
|
|
class HomeIconComponent extends React.Component { |
|
handleNavigation = () => { |
|
const { navigation, focused } = this.props |
|
if (!focused){ |
|
navigation.navigate("Home") |
|
}else if (navigation.state.index == 0){ |
|
if (navigation.state.routes[navigation.state.index].index != 0){ |
|
navigation.goBack(null) |
|
} |
|
} else if (navigation.state.index == 1 || navigate.state.index == 2){ |
|
navigation.navigate("Home") |
|
} |
|
|
|
} |
|
render(){ |
|
const { navigation, focused } = this.props |
|
|
|
return( |
|
<TouchableOpacity onPress={() => navigation.goBack() } style={{ justifyContent: 'center'}}> |
|
<Ionicons name="md-home" size={30} color={focused ? Colors.buttonBlue : '#404040'}/> |
|
</TouchableOpacity> |
|
|
|
) |
|
} |
|
|
|
} |
|
|
|
export default 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: MainTabNavigator, |
|
navigationOptions: ({ navigation }) => ({ |
|
tabBarIcon: ({ tintColor, focused }) => ( |
|
<HomeIconComponent color={tintColor} navigation={navigation} focused={focused}/> |
|
), |
|
}) |
|
}, |
|
|
|
|
|
|
|
|
|
|
|
} |
|
) |