React-native: How to update project to latest React Native version?

Created on 28 Apr 2015  路  5Comments  路  Source: facebook/react-native

I haven't been able to figure out how to update my project to the latest version of React Native.
Is there an official way to update? Apologies if this is a newb question. Thanks!

Locked

Most helpful comment

old version has index.android.js and index.ios.js
How could we add App.js and index.js and make it run successfully???

All 5 comments

I think that if you used react-native-cli command to create your project, you just need to change the version in the react dependency inside package.json and the run npm update

Thank you, that was the ticket.

This is an old question; on December 5, 2016, facebook have introduced react-native-git-upgrade for easier upgrade of react native.

Usage
Requirement: Git has to be available in the PATH. Your project doesn't have to be managed by Git.
Install react-native-git-upgrade globally:

$ npm install -g react-native-git-upgrade

or, using Yarn:

$ yarn global add react-native-git-upgrade

Then, run it inside your project directory:

$ cd MyProject
$ react-native-git-upgrade 0.38.0

Note: Do not run 'npm install' to install a new version of react-native. The tool needs to be able to compare the old and new project template to work correctly. Simply run it inside your app folder as shown above, while still on the old version.

See documentation: https://facebook.github.io/react-native/blog/2016/12/05/easier-upgrades.html

old version has index.android.js and index.ios.js
How could we add App.js and index.js and make it run successfully???

Was this page helpful?
0 / 5 - 0 ratings