升级到React Native 0.60后出现此错误.

我曾try 按照错误消息中的建议,使用react-native unlink <dependency>手动取消每个手动链接的依赖项的链接,但问题仍然存在.

错误消息如下:

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
  - react-native-admob (to unlink run: "react-native unlink react-native-admob")
  - react-native-facebook-account-kit (to unlink run: "react-native unlink react-native-facebook-account-kit")
  - react-native-fbsdk (to unlink run: "react-native unlink react-native-fbsdk")
  - react-native-gesture-handler (to unlink run: "react-native unlink react-native-gesture-handler")
  - react-native-linear-gradient (to unlink run: "react-native unlink react-native-linear-gradient")
  - react-native-localization (to unlink run: "react-native unlink react-native-localization")
  - react-native-restart (to unlink run: "react-native unlink react-native-restart")
  - react-native-vector-icons (to unlink run: "react-native unlink react-native-vector-icons")
  - react-native-webview (to unlink run: "react-native unlink react-native-webview")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

推荐答案

我通过以下操作成功地消除了错误:

  1. 创建一个本地的.配置.js文件位于项目的根目录中.
  2. 将其更新为以下内容:
// react-native.config.js
module.exports = {
  dependencies: {
    '<dependency>': {
      platforms: {
        android: null, // disable Android platform, other platforms will still autolink
      },
    },
  },
};

Source

React-native相关问答推荐

'无法解析模块.安装react-native-pager-view后的实用程序/平台

React Native 动画.您必须在转换属性中精确指定一个属性.

使用 React Native 正确处理注销

错误发生意外错误:https://registry.yarnpkg.com/react-native-template-react-native-template-typescript:未找到

更改所选标签栏元素的底部边框 colored颜色

React 从 babel 6 到 babel 7 的原生升级

滚动到具有可变元素大小的 FlatList 中的某些索引的有效方法

使用 Android NDK 在 C 或 C++ 中创建 react-native Native Module?

React-Native 按钮居中对齐

submit提交后如何让 React Native TextInput 保持焦点?

是否可以在 React Native 中隐藏BugReporting extraData?

如何在 React Native 中访问原生 UI 组件的实例方法

react-native 自动完成文本输入

如何在 React 中使用带有钩子的生命周期方法?

react-navigation模式高度

在 React-Native 中手动设置 opacity 的 onPress of TouchableOpacity 的音量

React.createClass vs. ES6 箭头函数

如何在 react-native 中为在后台杀死的 android 应用程序保持状态

开始滚动时使 TouchableOpacity 不突出显示元素

react-native:0.41 app.json