Skip to content

Commit 62a7c92

Browse files
author
Uncle Charlie
committed
add how to upgrade RN
1 parent 7da3b87 commit 62a7c92

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
11
# react-native-tutorial
22

33
This is a react native tutorial demos repo.
4+
5+
## How to upgrade to the latest RN
6+
7+
I think the best way to do this is to create a new RN project that has the same name as your existing project.
8+
9+
Then there are two parts you will have to deal with.
10+
1. `package.json` file related.
11+
2. non-`package.json` file related.
12+
13+
### `Package.json` things
14+
15+
Copy newest dependencies and replace your existing ones and keep others.
16+
17+
Basically these stuff.
18+
```json
19+
"dependencies": {
20+
"react": "16.6.3",
21+
"react-native": "0.58.3"
22+
},
23+
"devDependencies": {
24+
"babel-core": "^7.0.0-bridge.0",
25+
"babel-jest": "24.0.0",
26+
"jest": "24.0.0",
27+
"metro-react-native-babel-preset": "0.51.1",
28+
"react-test-renderer": "16.6.3"
29+
},
30+
"jest": {
31+
"preset": "react-native"
32+
}
33+
```
34+
35+
### Non-`package.json` things
36+
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.
37+
38+
Then copy files like:
39+
* `.buckconfig`
40+
* `.flowconfig`
41+
* `.gitattributes`
42+
* `.gitignore`, **DO REMEMBER** to merge this file, you have to keep you own modification.
43+
* `.watchmanconfig`
44+
45+
### Upgrade iOS
46+
47+
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.
48+
49+
### Upgrade Android
50+
51+
Just open your Android Studio and let the IDE do the upgrade job.
52+
53+
If you used NDK, well downlad a new version which is specified in RN doc.

0 commit comments

Comments
 (0)