仓促模块图中不存在模块“反应导航”

时间:2019-11-01 06:07:54

标签: react-native react-navigation

尽管我已经安装了“ react-navigation”和“ react-native-gesture-handler”,但我还是面临着“快速导航在映射模块映射中不存在”的问题

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

const RootStack = createStackNavigator({
  SplashScreen: { screen: SplashScreen },
  MainScreen: { screen: MainScreen },
  AddExpenseScreen: { screen: AddExpenseScreen },
}, {
  initialRouteName: 'SplashScreen',
  headerMode: 'none'
})

const App = createAppContainer(RootStack)

Package.json
------------
"dependencies": {
    "react": "16.8.3",
    "react-native": "0.59.9",
    "react-native-gesture-handler": "^1.5.0",
    "react-native-navigation": "^3.3.0",
    "react-redux": "^7.1.1",
    "redux": "^4.0.4",
    "redux-logger": "^3.0.6"
  },

2 个答案:

答案 0 :(得分:0)

在package.json中,它显示“ react-native-navigation”,但您是从“ react-navigation”导入的。

确保正确遵循说明https://reactnavigation.org/docs/en/getting-started.html

答案 1 :(得分:-1)

而不是:

const App = createAppContainer(RootStack)

尝试:

export default createAppContainer(RootStack);

查看this了解详情。