Reputation: 11
I have a react-native source. i can find the react-native-script in script section of package.json file. i want to know the difference between react-native and react-native-script. and .expo and react native cli . Can you give me good response for it?
I have only experience in react native cli, but can not understand the react-native script. Thank you
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
Want to run it using react native cli. How to run it? Thank you
Upvotes: 0
Views: 1101
Reputation: 89
The latest version of react-native-scripts
is a wrapper for the Expo-cli. Assuming you're using something similar to what RNS has become, you're using expo.
Expo does a lot of great things, but the main difference I notice is that it abstracts the build process for you. There are cons to this though. Since it takes care of the build process, you won't be able to link certain packages like Stripe's mobile SDK. Expo has to add all of these things and have it available in their API in order for you to use.
If you're going to need to use packages that Expo doesn't support then you opt out of using it. You will now have to maintain respective ios
and android
folders and handle the build process which includes linking libraries with native dependencies.
So, if you don't want to proceed with react-native-scripts
, you have the option of running the eject
script. This will remove expo from your project and you will handle building and linking amongst other things. Please read up on ejecting and proceed with prudent version control in case anything goes wrong.
Upvotes: 1
Reputation: 298
You're getting in way too deep. I have been doing RN for a year and never got that deep. That deep stuff was purposefully abstracted away from you so you don't have to worry about it.
For starting point, you don't need to know much more about react-native-scripts
. Just know to start a project using npm start
. To run in ios using npm ios
, to run in android using npm android
. That is enough to start with react-native.
Upvotes: 0