12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- /**
- * 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 (
- <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
- <TouchableOpacity onPress={() => {
- this.props.navigator.switchToTab({
- tabIndex: 1 // (optional) if missing, this screen's tab will become selected
- });
- }}>
- <Text>Camera: Click here to switch to tab 1</Text>
- </TouchableOpacity>
-
- </View>
- );
- }
- }
|