NativeBase 2.0-如何在抽屉组件中导航?

时间:2018-07-10 15:28:22

标签: react-native native-base

我最近尝试使用Native Base 2.0的Drawer组件,该组件基本上具有以下模板:

closeDrawer = () => {
  this.drawer._root.close()
};
openDrawer = () => {
  this.drawer._root.open()
};

render() {
  return (
    <Drawer
       ref={(ref) => { this.drawer = ref; }}
       content={<SideBar navigator={this._navigator} />}
       onClose={() => this.closeDrawer()} >

    <Content>
      insert content here
    </Content>
    </Drawer>
  )
}

我在其中创建了带有一些ListItems的客户SideBar组件,并使用react-navigation程序包使这些列表项可单击。

onPress={() => this.props.navigation.navigate(data)}>

问题是我没有从侧边栏获得this._navigator属性,并且总是收到此错误:

enter image description here

2 个答案:

答案 0 :(得分:2)

NativeBase已弃用Drawer,请改用react-navigation

答案 1 :(得分:1)