ReactNative升级0.56.0注意问题

栏目: IOS · Android · 发布时间: 5年前

内容简介:当前项目react-native的版本是0.53.3,因为最近在做一系列性能优化的工作,于是计划升级一下RN的版本,升级至0.56.0。 先看一下ReactNative0.56.0版本更新的内容:首先全局安装react-native-git-upgrade工具模块:那么更新到0.56.0就是

当前项目react-native的版本是0.53.3,因为最近在做一系列性能优化的工作,于是计划升级一下RN的版本,升级至0.56.0。 先看一下ReactNative0.56.0版本更新的内容: github.com/react-nativ… 步骤及遇到的问题如下:

1.使用https://reactnative.cn/docs/upgrading/中基于Git的自动合并更新方式:

首先全局安装react-native-git-upgrade工具模块:

$ npm install -g react-native-git-upgrade
复制代码

2.接下来进行更新操作

$ react-native-git-upgrade
# 这样会直接把react native升级到最新版本

# 或者是:

$ react-native-git-upgrade X.Y.Z
# 这样把react native升级到指定的X.Y.Z版本
复制代码

那么更新到0.56.0就是

$ react-naitve-git-update 0.56.0
复制代码

3.等待升级结束后,需要解决冲突, 下面的这些文件的冲突都需要进行解决一下

ReactNative升级0.56.0注意问题
文件中的冲突会以分隔线隔开,并清楚的标记出处,例如下面这样:

13B07F951A680F5B00A75B9A /* Release */ = {
  isa = XCBuildConfiguration;
  buildSettings = {
    ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
<<<<<<< ours
    CODE_SIGN_IDENTITY = "iPhone Developer";
    FRAMEWORK_SEARCH_PATHS = (
      "$(inherited)",
      "$(PROJECT_DIR)/HockeySDK.embeddedframework",
      "$(PROJECT_DIR)/HockeySDK-iOS/HockeySDK.embeddedframework",
    );
=======
    CURRENT_PROJECT_VERSION = 1;
>>>>>>> theirs
    HEADER_SEARCH_PATHS = (
      "$(inherited)",
      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
      "$(SRCROOT)/../node_modules/react-native/React/**",
      "$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
    );
上面代码中的"ours"表示你自己的代码,而"theirs"表示 React Native 的官方代码。然后你可以根据实际情况判断,选择某一方晋级,另一方出局。
复制代码

注意问题

一、0.56.0以上的RN使用Babel 7

React Native now uses Babel 7 When upgrading to 0.56, make sure to bump your babel-preset-react-native package.json dependency to 5.0.2 or newer (but still as fixed value). React Native 现在使用 Babel 7,升级到 0.56 后,请确保将 babel-preset-react-native package.json 依赖项升级到 ^5.0.2 或更高版本。 那么就需要升级一下babel-preset-react-native版本

yarn add babel-preset-react-native@5.0.2 --dev
复制代码

二、升级后遇到react native version mismatch问题

ReactNative升级0.56.0注意问题

参考了https://stackoverflow.com/questions/47763824/react-native-version-mismatch中的解决方案: 1.IOS

For others with the same problem on iOS with CocoaPods:

I tried all of the solutions above, without luck. I have some packages with native dependencies in my project, and some of those needed pod modules being installed. The problem was that React was specified in my Podfile, but the React pod didn't automatically get upgraded by using react-native-git-upgrade.

The fix is to upgrade all installed pods, by running cd ios && pod install.
复制代码

以上所述就是小编给大家介绍的《ReactNative升级0.56.0注意问题》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Complete Web Monitoring

Complete Web Monitoring

Alistair Croll、Sean Power / O'Reilly Media / June 29, 2009 / GBP 39.99

Do you know the true value of your website to your organization? i??Complete Web Monitoringi?? shows you how to integrate several different views of your online business - including analytics, back-en......一起来看看 《Complete Web Monitoring》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

SHA 加密
SHA 加密

SHA 加密工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具