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

NativeBase 2.0 - How to navigate in the Drawer component?

我最近尝试使用 Native Base 2.0 的抽屉组件,基本上有这个模板:

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>
  )
}

我制作了我的客户 SideBar 组件,其中包含一些 ListItems,我使用 react-navigation 包使这些列表项可点击。

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

问题是我没有得到从边栏传递的 this._navigator 属性,而且我总是收到这个错误:

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

他们在 v2.8.0 中添加了 Drawer

https://github.com/GeekyAnts/NativeBase/releases/tag/v2.8.0