ReactNative #1 的一般问题:RCT.RootContentView.h 找不到文件 ReactNativeGestureHandler.m

General Problems with ReactNative #1: RCT.RootContentView.h file not found ReactNativeGestureHandler.m

当 NPM Install 期间安装的 ReactNativeGestureHandler 版本与安装的 React-Native 版本不兼容时,就会出现此问题。

解决这个问题:

  1. 检查package.json中提到的版本和node_modules中package.json中实际安装的版本。

  2. 检查package.json中提到的React-Native版本和node_modules

  3. 中实际安装的版本
  4. 查看 ReactNativeGestureHandler 的文档以了解 React-Native 版本支持。

  5. 相应地降级或升级版本。

  6. ^ 在 package.json 下载更高版本,删除 ^ 并仅保留版本号确保每次 npm install(也适用于 yarn)时安装相同的版本 运行.

例如。

我的react-native版本是0.58

ReactNativeGestureHandler 的预期版本下载为 1.0.15("react-native-gesture-handler": "^1.0.15",此安装更高版本),

改为"react-native-gesture-handler": "1.0.15"