'Check if developer options is enabled in React-native

I am developing a react-native web view app. For some reason, On Android. I don't want my users to allow inside the app if enable developer options are turned on. How can I achieve this?



Solution 1:[1]

When you are developing your app locally, it will be in a "development" build, which has the developer options enabled by default.

When you release your app to the public, not only will it have better performance, but the developer options will be disabled by default.

The Developer Menu is disabled in release (production) builds. https://reactnative.dev/docs/debugging

To try it out yourself, you can build a release version of your app.

npx react-native run-android --variant=release

In short, you shouldn't have to worry about your users having access to the developer options.

Additionally, there is a constant value of __DEV__ which will be true in development builds but false in release builds, you can also check it to toggle features based on environment.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1