React Navigation在Drawer v3上渲染堆栈屏幕

时间:2019-01-28 20:23:35

标签: react-native react-navigation

我在屏幕上使用了两个导航器createStackNavigatorcreateDrawerNavigator。我要求我的“ HOME”屏幕(在createStackNavigator中定义)必须先呈现而不传递到createDrawerNavigator中,并且抽屉在HOME屏幕上绘制,而其他屏幕在抽屉中。但我收到此错误:

error image

这是我的代码:

import React, { Component } from 'react';
import { View, Text } from 'react-native';
import Home from './src/components/home'
import Account from './src/components/account'
import About from './src/components/about'

import {createAppContainer,createDrawerNavigator,createStackNavigator} from 'react-navigation';


class App extends Component {
render() {
   return <MyApp />;
  }
}
export default App;

const MyDrawerNavigator = createDrawerNavigator({
  AppStack: AppStack,
  Account: Account,
});

  const AppStack = createStackNavigator({
  Home: Home,
  About: About,
  });

   const MyApp = createAppContainer(MyDrawerNavigator);

如何解决该错误?

0 个答案:

没有答案