How can I determine if my React Native app is a debug or release build from JavaScript code?
JavascriptIosReact NativeJavascript Problem Overview
I'd like to add some debug-only UI to my React Native app, but I can't find any equivalent of RCT_DEBUG
or RCT_DEV
compile-time flags in the JavaScript environment. Is there one?
Use case: I want to add a status bar that shows the number of HTTP requests initiated by my app. Obviously this is not part of a shipping app, but it would help me check my work while in development and testing.
Javascript Solutions
Solution 1 - Javascript
if (__DEV__) {
console.log('I am in debug');
}
You can see this approach is being used in React Native repository.