Adam Katz Adam Katz - 1 month ago 6
JSON Question

updating package.json to add android to react native

I have a ios react native app and I would like to add the android part to it.

I do not understand this line in the docs

Update the react-native dependency in your package.json file to the latest version

Currently my package.json file looks like this

{
"name": "sassi",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start"
},
"dependencies": {
"react-native": "^0.15.0",
"react-native-icons": "^0.7.0",
"react-native-splashscreen": "^1.0.0"
}
}


Any help would be greatly appreciated

Answer

The "react-native dependency" is the part which indicates the react-native version you're working with.

In your case it's 0.15.0: "react-native": "^0.15.0".

The latest version of react native at the moment is 0.18, so according to the recommendation that you've mentioned, you should change the version to: "react-native": "^0.18.0".

You'll then need to run npm update to update the package.