androidreact-native

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.


Solution

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

    npx react-native run-android --variant release #android
    npx react-native run-ios --mode Release #ios
    

    To find other available options

    react-native run-ios -h
    react-native run-android -h
    

    UPDATE

    Be Advised! The react-native (v13.6.8) this operation syntax has changed.
    The new syntax is:

    npx react-native run-android --mode release
    npx react-native run-ios --mode release