Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you run react-native app in production mode?

I thought you could do this with react-native run-android --dev=false, but doing this doesn't stop the developer menu from showing up when I shake the phone and the request url to the packager has dev=true in the url params.

like image 673
eremzeit Avatar asked Jul 15 '16 23:07

eremzeit


People also ask

Is it possible to run a React Native app in the background?

With the help of Headless JS, Native Modules, and WorkManager, it is fairly easy to create and run JavaScript tasks in React Native. In this article, we covered from beginning to end setting up and running Headless JS in React Native Android, allowing us to run tasks in the background of our application.

What is difference between development mode and production mode?

Development mode includes useful warnings and gives you access to tools that make development and debugging easier. Production mode minifies your code and better represents the performance your app will have on end users' devices.


2 Answers

There are two configurations Release and Debug. By default apps run in debug mode. To run in Release mode

react-native run-android --variant release #android
react-native run-ios --configuration Release #ios

To find other available options

react-native run-ios -h
react-native run-android -h
like image 122
Haseeb A Avatar answered Nov 15 '22 16:11

Haseeb A


It's in the dev menu under the settings option. The key is that you then have to reload the JS. You can verify in your packager output that dev=false.

like image 29
eremzeit Avatar answered Nov 15 '22 17:11

eremzeit