美文网首页
React-Native 0.59.8升级0.63.2 问题收集

React-Native 0.59.8升级0.63.2 问题收集

作者: 笙笙哥 | 来源:发表于2020-03-05 10:42 被阅读0次

环境有差异,分享以我的环境(见最下面)为例的解决方法,希望有助于你

问题一:报错 Trying to register two views with the same name RCTVideo

原因:
升级Xcode 11, iPhone 13, OSX Catalina 10.15.3

基于这种环境下的Xcode变得更加智能了,也就是说,之前没有检车到的错误,现在也会检测,并且报错,无法运行。

react-native-gift-chat 同时也引用了 react-native-video
而且们的项目也引用了react-native-video。
所以一直报:
Trying to register two views with the same name RCTVideo
然后RN无法运行。

解决办法:

查看依赖

 npm list | grep react-native-video

去react-native-video 里删除react-native-video
并且package.json里
改为:"react-native-video":"*"

https://github.com/react-native-community/react-native-video/issues/1450

问题二:

NativeModule.ImagePickerManager is null.

  1. 手动引用 react-native-image-picker Xcode工程文件
  2. 手动引入 RNImagePicker.a文件

问题三:报错:

Unknown argument type"attribute_inmethod-irctappstate

找到文件RCTModuleMethod.mm,
路径:node_modules/react-native/React/Base/RCTModuleMethod.mm

(原文文件名称为RCTModuleMethod.mm.mm,或RCTModuleMethod.m)
在RCTParseUnused接口中新增新的解析字段,新增RCTReadString(input, "attribute((unused))")代码,如下:

static BOOL RCTParseUnused(const char **input)
{
  return RCTReadString(input, "__unused") ||
         RCTReadString(input, "__attribute__((__unused__))") ||     //lzj fixed
         RCTReadString(input, "__attribute__((unused))");
}

问题 四

(index):230 Uncaught (in promise) TypeError: window.deltaUrlToBlobUrl is not a function
原因

调试问题

方案(步骤)

  1. 浏览器上:关闭:http://localhost:8081/debugger-ui/,且重开http://localhost:8081/debugger-ui/
  2. 模拟器上:Mac: Ctrl + CMD + Z, Reload。
  3. 若App 未显示出来,或者浏览器报错,可以App 里重复第2步

问题五

unhandledpromiserejectionwarning: typeerror: fsevents is not a function

brew update
brew upgrade watchman

问题六

Tried to register two views with the same name ARTSurfaceView

"react-native-photo-browser": "^0.4.0"与"react-native": "^0.59.8"冲突,暂无解决方案,前者先用老版本。

问题七

79 duplicate symbols for architecture x86_64
react-native-tcp 与 react-native 自带的库(CocoaAsyncSocket)发生冲突。
解决办法:
去掉该库,或者使用其他库代替。

问题八

[!] CocoaPods could not find compatible versions for pod "React/Core":
  In Podfile:
    RNSound (from `../node_modules/react-native-sound`) was resolved to 0.10.12, which depends on
      React/Core

None of your spec sources contain a spec satisfying the dependency: `React/Core`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

解决办法:
去note_modules里面找到 react-native-sound/RNSound.podspec
第17行

  s.dependency 'React/Core'

改为

 s.dependency 'React-Core'

pod install 则会成功,或者没有该错误了。

我的环境

System:
    OS: macOS 10.15.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 206.79 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.14.0 - /usr/local/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0. - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.7, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.7/11E801a - /usr/bin/xcodebuild
  Languages:
    Java: 9.0.1 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.2 => 0.63.2 
  npmGlobalPackages:
    *react-native*: Not Found

相关文章

网友评论

      本文标题:React-Native 0.59.8升级0.63.2 问题收集

      本文链接:https://www.haomeiwen.com/subject/icytrhtx.html