2017-06-19 38 views
2

我不在代码中使用导航器。但我得到这个错误。导航仪已弃用,即使我不使用导航仪也被删除

enter image description here

"dependencies": { 
    "react": "16.0.0-alpha.12", 
    "react-native": "0.45.1", 
    "react-native-deprecated-custom-components": "^0.1.0", 
    "react-native-router-redux": "^0.2.2", 
    "react-redux": "^5.0.5", 
    "redux": "^3.7.0" 
}, 
"devDependencies": { 
    "babel-jest": "20.0.3", 
    "babel-preset-react-native": "2.0.0", 
    "jest": "20.0.4", 
    "react-test-renderer": "16.0.0-alpha.12" 
} 

任何人都可以帮我吗?

+0

“react-navigation”是否依赖它?它看起来像'react-native-implementation'的第120行使用它。 – Carcigenicate

+0

不,这不是必需的。 – david

+0

那么,我该如何解决它? – david

回答

0

Navigator中不再支持反应过来本地所以在此不再被允许:

import { Navigator } from 'react-native'

从“反应母语”进口取出导航以及与此替代它: import { Navigator } from 'react-native-deprecated-custom-components';

0

导航实验(以前的Navigator)已从React Native中删除并移至单独的包react-native-deprecated-custom-components。它已被弃用,不推荐。为了解决您的旧代码,您可以执行以下步骤

  1. 安装包react-native-deprecated-custom-components

    npm install react-native-deprecated-custom-components --save

  2. 进口NavigationExperimental(以前Navigator

    import NavigationExperimental from 'react-native-deprecated-custom-comreponents';

  3. 更换NavigatorNavigationExperimental.Navigator

1

这发生在我身上时,我的IDE自动添加以下行:

import * as AsyncStorage from "react-native"; 

这意味着:一切都在该文件中,这是行不通的。通过改变它来解决它:

import AsyncStorage from "react-native"; 
+0

令人难以置信!你在这里救了我几个小时! –