Upgrading React Native should be quite easy. But if you have an app that uses a very old version of React Native, things may be different. This post shows how to upgrade React Native from 0.42 to 0.51.
React Native has an official guide on how to upgrade. I used a simpler approach, just remove
android directories, update dependencies in
package.json and run
react-native upgrade. It will recreate all platform files. The version of
0.51.0, while the version of
React.PropTypes has been moved to a separate package
prop-types. Need to import
prop-types and change
Navigator has been deprecated and moved to a separate package react-native-deprecated-custom-components. I don't want to change the current usage of
Navigator, so I just import
Navigator from the new package. However, the current version
0.1.1 in npm has an issue with the usage of
React.PropTypes. The current code in
master branch fixed the issue but is not published to npm yet. I just cloned the repository and update the version using
npm version patch and published it to my local npm registry. See this post on how to use your own private npm registry.