/** * Created by zack on 2018/4/19. */ import { View, Text, StyleSheet, TouchableOpacity } from 'react-native' import React, {Component} from 'react' export default class CameraViewController extends Component { componentDidMount() { this.props.navigator.setOnNavigatorEvent(event => { if (event.id === 'bottomTabSelected') { if (event.selectedTabIndex === 2) { this.hideTabBar() } } else if (event.type === 'NavBarButtonPress') { }else if (event.type === 'ScreenChangedEvent') { if (event.id === 'willAppear') { //this.showTabBar() }else if (event.id === 'willDisappear') { } } }) } hideTabBar() { this.props.navigator.toggleTabs({ to:'hidden', animated: true }) } showTabBar() { this.props.navigator.toggleTabs({ to:'shown', animated: true }) } render() { return ( { this.props.navigator.switchToTab({ tabIndex: 1 // (optional) if missing, this screen's tab will become selected }); }}> Camera: Click here to switch to tab 1 ); } }