Sin descripción

CameraViewController.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * Created by zack on 2018/4/19.
  3. */
  4. import {
  5. View,
  6. Text,
  7. StyleSheet,
  8. TouchableOpacity
  9. } from 'react-native'
  10. import React, {Component} from 'react'
  11. export default class CameraViewController extends Component {
  12. componentDidMount() {
  13. this.props.navigator.setOnNavigatorEvent(event => {
  14. if (event.id === 'bottomTabSelected') {
  15. if (event.selectedTabIndex === 2) {
  16. this.hideTabBar()
  17. }
  18. } else if (event.type === 'NavBarButtonPress') {
  19. }else if (event.type === 'ScreenChangedEvent') {
  20. if (event.id === 'willAppear') {
  21. //this.showTabBar()
  22. }else if (event.id === 'willDisappear') {
  23. }
  24. }
  25. })
  26. }
  27. hideTabBar() {
  28. this.props.navigator.toggleTabs({
  29. to:'hidden',
  30. animated: true
  31. })
  32. }
  33. showTabBar() {
  34. this.props.navigator.toggleTabs({
  35. to:'shown',
  36. animated: true
  37. })
  38. }
  39. render() {
  40. return (
  41. <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
  42. <TouchableOpacity onPress={() => {
  43. this.props.navigator.switchToTab({
  44. tabIndex: 1 // (optional) if missing, this screen's tab will become selected
  45. });
  46. }}>
  47. <Text>Camera: Click here to switch to tab 1</Text>
  48. </TouchableOpacity>
  49. </View>
  50. );
  51. }
  52. }