In, react-native info how to check RN version? - react-native

In Terminal,
react-native: 0.68.0 => 0.60.0
does it mean that this project version is 68 or 60? In pacakge.json, i manually changed it to 0.68 and then npm install. and I checked react-native info.

Don't try to change manually react native version because sometimes as per version level some internal files or set up not done properly and it will create issue for running project Use below command for upgrade project
npx react-native upgrade
If you want to upgrade specific version then use below command
npx react-native upgrade 0.68
after then check react native version It will show 0.68

Related

react native how to upgrade project version 0.61.0to latest version

React native 61 to 64 +
current version 0.61.0
upgrade to latest version
best way to upgrade project
npx react-native upgrade cd ios pod install
for upgrade to specific version You may specify a React Native version by passing an argument, e.g. to upgrade to 0.64.0
npx react-native upgrade 0.64.0
It's not simply change the version and npm install again. You may view the official documentation for help.
https://react-native-community.github.io/upgrade-helper/

Strange react-native Version Number When Running from Local `node_modules`

When I run react-native --version from the global installation, it reports to me what I consider to be an accurate version number, like this:
react-native-cli: 2.0.1
react-native: 0.61.4
However, when I run yarn react-native --version (from the local installation at node_modules, it reports the version number simply as 3.2.1.
Can anyone explain why?
EDIT: The definitive way to find the react native version number for your local project is to run react-native info locally. This can be done one of the following ways:
npm run react-native info
yarn react-native info
In answer to the original question: "Why am I seeing the strange version number?", here is my analysis:
As it turns out, I did not have react-native installed globally. I had react-native-cli installed globally.
If you open Terminal and cd to some random directory and run react-native --version (assuming you also have react-native-cli installed), the response will look something like this:
$ react-native --version
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
If you then cd to a react-native project's root folder and run react-native --version, it will return the actual version number of that local project.
However, when you run yarn react-native --version from the root folder of a react-native project, what actually gets returned is the version of the #react-native-community/cli installation. (You get the same result if you run npx react-native --version or if you look in the package.json file of the local #react-native-community/cli installation in node_modules/#react-native-community/cli.
So, long story short, if you want to know the exact react-native version your local project is using, use react-native info (easy) or open up ./node_modules/react-native/package.json and it will tell you the version number.

How to run an old version of react native

Just a quick question, how to run an existing older version of react native project. Lets say version 0.59.10 , without upgrading it. what would be the command line commands. Thanks
You should navigate to project directory (if you aren't yet)
cd PATH_TO_PROJECT_DIRECTORY
run the following command to install the dependencies
npm install
then if the react-native version is 0.59.10 and lowers you should also run the command below to link the dependencies to your native android and ios project.
react-native link
and then run one the following commands based on your device
for android
react-native run-android
for ios
react-native run-ios

React Native version check

I wanted to check the version of the react native I was using in my project when I used the command from my root folder :
D:\Reactnative\Albums>npm view react-native version
0.56.0
The version was 0.56.0 which is not the version I have installed, but on:
D:\Reactnative\Albums>react-native -v
react-native-cli: 2.0.1
react-native: 0.55.4
The version mentioned here is 0.55.4, which is correct.
So why this conflict?
npm view react-native version
You can check the latest version of react native. You can run it under the root of your project or everywhere. Of course, you will need internet connection to check latest version.
react-native -v
If you run under the root of project, it will return the version of two npm packages, react-native-cli and react-native. Those versions are using in your project.
Just wanted to clarify Aung's answer:
npm view react-native version checks globally while react-native -v ran inside project's root folder checks version of the app itself.
Macbook M1 Chip
npm view react-native version

'React/RCTBridgeModule.h' file not found when using react native fbsdk

I am using react-native-fbsdk in my application.
My react-native version is:0.39.1
I followed the all steps and when I build my project I'm getting the following error.
Can anyone please tell me how to solve this.
There was a breaking change in React-Native 0.40 where the headers have been moved to React namespace.
If you use a version prior to 0.40 you have to change 'React/RCTBridgeModule.h' to 'RCTBridgeModule.h' inside of RCTFBSDKAppEvents.m
See here for more info : https://github.com/facebook/react-native/releases/tag/v0.40.0
Or you can upgrade your react-native version: https://facebook.github.io/react-native/docs/upgrading.html
The latest version of react-native-fbsdk ( which is 0.5.0) only works with RN >=0.40.
For RN <0.40, do the following:
1) Uninstall react-native-fbsdk:
npm uninstall react-native-fbsdk --save
2) Reinstall with an older version and link it:
npm install react-native-fbsdk#0.4.0 --save
react-native link react-native-fbsdk