You can use the __DEV__ global variable in JavaScript to determine if you're using React Native packager or not. If you are running your app in the iOS Simulator or Android emulator __DEV__ will be set to true.
You can use the __DEV__ variable.
By default if you run your app with npx react-native run-ios or npx react-native run-android, it will run in Debug mode and __DEV__ will be true.
In release mode, __DEV__ will be false.
You can use it this way:
You can run the app in Release mode with the terminal:
react-native run-android --variant release #android
react-native run-ios --configuration Release #ios
Or open the ios folder in XCode, choose Product > Scheme > Edit Schemes
Select Run in the left menu. For Build Configuration, choose 'Release' and uncheck 'Debug executable'
In Android Studio, similarly, you can set the build variant to release