【问题标题】:How change screen dynamically using Drawer Navigator如何使用 Drawer Navigator 动态更改屏幕
【发布时间】:2018-06-24 03:27:03
【问题描述】:

我有一个有 2 个屏幕的抽屉式导航器,主页和配置文件。我需要的是,当我单击 TouchaleOpacity 时,将屏幕从主页更改为配置文件,我该怎么做?

import { DrawerNavigator } from 'react-navigation';

import JsHome from './JsHome'
import JsProfile from './JsProfile'

const DrawerExample = DrawerNavigator({
  JsHome : {
    screen: JsHome 
  },

  JsProfile : {
    screen: JsProfile 
  },
}

PS:TouchableOpacity 在另一个 js 文件中

【问题讨论】:

    标签: react-native navigation-drawer


    【解决方案1】:

    每个屏幕都有导航道具。在可触摸的不透明度中使用 this.props.navigation.navigate('JsProfile')

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-20
      • 2020-04-21
      • 2021-01-21
      • 1970-01-01
      相关资源
      最近更新 更多