我创建了自定义边栏,并有5到6个屏幕。我正在使用NativeBase,并希望使用DrawerNavigator选项打开补充工具栏,但是当我应用以下代码时,出现了问题。
抽屉导航器代码
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
答案 0 :(得分:0)
此处的错误是您使用的是DrawerNavigation
而不是createDrawerNavigator
。
只要做那些改变,你就应该好
import { createDrawerNavigator } from "react-navigation";
...
const SidebarNavigator = createDrawerNavigator( ... )
来源:https://reactnavigation.org/docs/en/drawer-navigator.html
答案 1 :(得分:0)
您可以尝试使用此代码
您可以使用createDrawerNavigator
和createAppContainer
import { createDrawerNavigator, createAppContainer } from "react-navigation";
...
const SidebarNavigator = createDrawerNavigator( ... )
const AppContainer = createAppContainer(SidebarNavigator);
// Now AppContainer is the main component for React to render
export default AppContainer;