Do we need to merge node module folder in production environment for react-native app? - react-native

Do we need to merge node module folder when code goes to production Do we need to merge node module folder in production for react-native app for react-native app.
If yes then why we need this folder and if no how can we ignore the folder.

No need to manually merge something (e.g. node_modules) to the final app.
You can, of course, use Android Studio or XCode to build the release version, but using below commands to package the apps will be much more handy:
//Build release version
react-native run-android --variant=release
react-native run-ios --configuration Release
Reference:
https://facebook.github.io/react-native/docs/running-on-device.html

Related

Not going to release apk after expo eject

I created a new project at Expo, after which I was already building it using expo buildbut over time I needed to move away from Expo a little and execute an expo eject, and then continue development on regular React Native.
I ran into the following situation: I am trying to build an apk file with the ./gradlew assembleRelease command, but I get a debug build instead of release, I don’t understand why this is happening, I tried to follow the build instructions specifically for the release version - unsuccessfully.
I also tried to create a new project without using Expo - the whole scenario described above worked correctly and I got a release build of my application, and with all that, I compared the android/app/build.gradle files in these two projects and they are almost identical in terms of their configuration.
My main task and problem is to build the release version of the apk file and understand why, with different attempts to build, I only get the debug apk.

build archive fails but build from react-native run-ios works

my react-native project builds and run from npx react-native run-ios and also it runs from xcode. now i am almost done with what i want to do and wanted to publish a version for test flight on app store but i cant archive the product which is how i used to do before. it fails right away with some swift error. in this work i added a dummy swift file and xcode also added bridge file as part of it. here is the error i get:
Been there,
make sure all the three pod, project and target have the same IOS Deployment Target.

Generate Android and IOS folder in react native directory with Yarn

I have been having some trouble finding some straight answers in generating android and ios packages in a pre-existing react-native project.
yarn start works for me to view my project in on the web browser but I am trying to create an ios and android native project from this pre-existing website. Right now I have an empty template project that can be made using these commands on Mac Os after installing yarn:
yarn create react-app website
Now here is what my directory looks like. It is missing the android and ios directories that I will use and then run the command
yarn ios
or
yarn android
Thanks I really appreciate the help. I have never worked with react-native so if the answer is obvious please explain anyways.
yarn create react-app website
It will create website only, if you want to create react native app use
expo init AwesomeProject
or
npx create-react-app my-app
or
npx react-native init AwesomeProject
If you want to give support of web inside your react-native app, you can use react-native-web

is it necessary to rebuild react-native project after linking

I would like to know if it's necessary to rebuild react native project after installing and linking libraries that includes native codes.
Yes, as react-native-link updates some native files that are under the ios/android folder, that won't be checked during a reload/hot-reload/live-reload. All those files aren't checked in your jsBundle and are compiled during a run-android or run-ios.
Of course, if you added a new dependecy to the project and linked it, and you haven't used it anywhere in your code yet, you don't need it. If you are using that dependecy, your project instance will, most likely, die.
if your react native version is below 0.60 then you have to run react-native-link after you install any react-native module. However after react-native version 0.60 and above, this is done automatically using the new "autolinking" feature added.
Read the changelog here:
https://facebook.github.io/react-native/blog/2019/07/03/version-60
However you still need to rebuild your project after you install a native module but you dont need to run the react-native-link command anymore after installing every library after react-native#0.60 and above. Just type react-native run-android

does not create xcode project file in react-native

When I run create-react-native-app AwesomeProject, no XCode project gets generated.
Just this files created :
It's a normal result. create-react-native-app is not supposed to create ios and android folders. It is to be used with Expo client.
If you want to have Xcode files, use react-native-cli:
On the top of this page, click "Building Projects with Native Code" instead of "Quick Start".
run npm run eject at the root of your project folder, it will create ios and android folders.
This will start the process of "ejecting" from Create React Native App's build scripts. You'll be asked a couple of questions about how you'd like to build your project.