博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
将React Native升级到最新版本的最简单方法
阅读量:2532 次
发布时间:2019-05-11

本文共 3455 字,大约阅读时间需要 11 分钟。

by Sam Johnson

由山姆·约翰逊(Sam Johnson)

将React Native升级到最新版本的最简单方法 (The easiest way to upgrade React Native to the latest version)

I’ve read many horror stories from people who have spent days trying to upgrade React-Native to the latest version. The official guideline as mentioned do not work in most cases.

我已经阅读了许多花了几天时间试图将React-Native升级到最新版本的人的恐怖故事。 提到的官方指南在大多数情况下不起作用。

Below is the way I found out after so many trials and errors to be the easiest.

下面是我经过如此反复尝试和发现后发现的最简单方法。

There is a wonderful tool named (please don’t be fooled by the name, it won’t do any kinds of purge ?). What this tool does is compare different versions of react-native and shows you the differences from the source code level. By seeing the differences, you can make changes accordingly to the build. It depends on the number of libraries you are using, but the initial build could succeed at once or show some errors. Then you can work on those errors one by one.

有一个名为的奇妙工具(请不要被这个名称所迷惑,它不会进行任何类型的清除?)。 该工具的作用是比较不同版本的react-native,并向您显示与源代码级别的不同。 通过查看差异,可以对构建进行相应的更改。 这取决于您使用的库的数量,但是初始构建可能会立即成功或显示一些错误。 然后,您可以一一解决这些错误。

I have used the tool to upgrade react-native three times so far, and it has taken me from 30 minutes to 1 hour to finish the upgrade.

到目前为止,我已经使用该工具对本机进行了三次升级,完成升级需要30分钟到1个小时。

Below are the steps I take every time I decide to do an upgrade:

以下是每次我决定进行升级时应采取的步骤:

  • Make sure your codebase is in solid condition, which means you have ironed out all the known issues.

    确保您的代码库处于稳定状态,这意味着您已经解决了所有已知问题。
  • Make sure you have committed all your changes:

    确保已完成所有更改:
git add . git commit -m “Last commit before upgrade to RN version 0.59.0” git push
  • Copy & paste this to your browser:

    复制并粘贴到您的浏览器中: :

  • Manually make changes according to the differences being shown.

    根据显示的差异手动进行更改。
  • Run npm i to update versions

    运行npm i以更新版本
  • Build & Deploy through Android Studio and Xcode

    通过Android Studio和Xcode进行构建和部署

If no errors are shown, start your unit testing.

如果未显示任何错误,请开始单元测试。

If some errors are shown, the errors are more likely due to the libraries you are using. If this is the case, go to the github repo for the library that gives error.

如果显示一些错误,则可能是由于您使用的库而引起的。 如果是这种情况,请转到提供错误的库的github存储库。

For example, when I upgraded React-Native from 0.58.6 to 0.59.0, a library I used (“lottie-react-native”) gave me some compiling errors under Android Studio. So I went to their github site and found . Then I followed the instructions mentioned there to solve the issue.

例如,当我将React-Native从0.58.6升级到0.59.0时,我使用的库(“ lottie-react-native”)在Android Studio下给了我一些编译错误。 所以我去了他们的github站点,发现了 。 然后,我按照那里提到的说明解决了该问题。

You will certainly encounter many¹ issues, but most issues ( if not all ) I have encountered so far are caused by the libraries I used, not by React-Native itself.

您肯定会遇到很多问题,但是到目前为止,我遇到的大多数问题(即使不是全部)都是由我使用的库引起的,而不是React-Native本身引起的。

When you are satisfied with all the changes, run git diff to see the changes, then git add . git commit -m "Complete React Native Upgrade" git push .

当您对所有更改感到满意时,请运行git diff查看更改,然后运行git add . git commit -m "Complete React Native Upgrade" git push

Congratulations! You are ready to use the latest features provided by the latest React-Native versions.

恭喜你! 您准备使用最新的React-Native版本提供的最新功能。

Note: some issues do not have immediate solutions (which might require a new version of the libraries themselves). But the good news is that all the issues will have some kind of workaround. ?

注意:某些问题尚没有立即解决的方法(可能需要库本身的新版本)。 但好消息是,所有问题都将具有某种解决方法。 ?

翻译自:

转载地址:http://ryewd.baihongyu.com/

你可能感兴趣的文章
第一次作业
查看>>
“==”运算符与equals()
查看>>
单工、半双工和全双工的定义
查看>>
Hdu【线段树】基础题.cpp
查看>>
时钟系统
查看>>
BiTree
查看>>
5个基于HTML5的加载动画推荐
查看>>
水平权限漏洞的修复方案
查看>>
静态链接与动态链接的区别
查看>>
Android 关于悬浮窗权限的问题
查看>>
如何使用mysql
查看>>
linux下wc命令详解
查看>>
敏捷开发中软件测试团队的职责和产出是什么?
查看>>
在mvc3中使用ffmpeg对上传视频进行截图和转换格式
查看>>
python的字符串内建函数
查看>>
Spring - DI
查看>>
微软自己的官网介绍 SSL 参数相关
查看>>
Composite UI Application Block (CAB) 概念和术语
查看>>
64位MATLAB和C混合编程以及联合调试
查看>>
原生js大总结二
查看>>