You can turn development mode on and off in the expo XDE, but how do you detect it in your code so you can switch on debug logging or do something differently for the debug build? Their docs show how to enable it, and see it in the UI, but not how to test for it in code.
Asked
Active
Viewed 6,171 times
20
-
11Does `if (__DEV__) { ... }` work? – dikaiosune Oct 20 '17 at 15:52
2 Answers
19
This always works for me. No need to look in the packagerOpts.
if (__DEV__) {
// do dev stuff
}

GollyJer
- 23,857
- 16
- 106
- 174
2
My last question was answered with let isDev = packagerOpts && packagerOpts.dev
which is in Constants.manifest
https://forums.expo.io/t/constants-manifest-packageropts-dev-is-undefined/10890/5

ericjam
- 1,501
- 2
- 20
- 30