Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
147
rated 0 times [  150] [ 3]  / answers: 1 / hits: 41929  / 9 Years ago, mon, december 28, 2015, 12:00:00

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.


More From » ios

 Answers
9
if (__DEV__) {
console.log('I am in debug');
}


You can see this approach is being used in React Native repository.


[#63918] Friday, December 25, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
joep

Total Points: 32
Total Questions: 97
Total Answers: 104

Location: Wales
Member since Thu, Jul 1, 2021
3 Years ago
;