How to upgrade to the latest RN

How to upgrade to the latest RN

I think the best way to do this is to create a new RN project that has the same name as your existing project.javascript

Then there are two parts you will have to deal with.java

  1. package.json file related.
  2. non-package.json file related.

Package.json things

Copy newest dependencies and replace your existing ones and keep others.react

Basically these stuff.android

"dependencies": {
    "react": "16.6.3",
    "react-native": "0.58.3"
  },
  "devDependencies": {
    "babel-core": "^7.0.0-bridge.0",
    "babel-jest": "24.0.0",
    "jest": "24.0.0",
    "metro-react-native-babel-preset": "0.51.1",
    "react-test-renderer": "16.6.3"
  },
  "jest": {
    "preset": "react-native"
  }

Non-package.json things

If your package is really old that you still have index.ios.js / index.android.js. You will have to do something to your codes to morden styles, like there might have App.js and app.json and index.js. Generally files like this.ios

Then copy files like:git

  • .buckconfig
  • .flowconfig
  • .gitattributes
  • .gitignore, DO REMEMBER to merge this file, you have to keep you own modification.
  • .watchmanconfig

Upgrade Babel Config

Maybe it's OK to keep your babel config file name as .babelrc, but the current one is named babel.config.js. So let's name it as the new one.json

Change the content of the config file to:swift

module.exports = {
  presets: ["module:metro-react-native-babel-preset"]
}

Upgrade iOS

You might going to upgrade swift version. Follow the swift way. I met some problems in swift 4.2. The class method can not be called in OC. As there's a modification in Swift 4.2.react-native

Upgrade Android

Just open your Android Studio and let the IDE do the upgrade job.babel

If you used NDK, well downlad a new version which is specified in RN doc.

相關文章
相關標籤/搜索