Loving Expo and React Native, but I’m running into a strange problem once I publish my app…
In debug mode against the local packager, the app runs fine. I can walk through the onboarding process without a problem. However, once “published”, the first few steps of onboarding work as expected, but the culminative step appears to fail and restart the app. The symptom is that the activity stops, I get the white screen with spinner (just like when initially launching) and then the first screen appears.
The step it is failing on is doing some fairly heavy crypto calculations - which takes a couple of seconds on my phone - tying up the JS thread. This is behind a modal spinner which continues to spin - so I figured all was OK. The crypto stuff was hard to get working - but, again, it works fine on my development environment …
Hm, interesting. The bundle that’s generated for publish is AFAIK almost exactly identical to the bundle you get when dev mode is turned off. Is my understanding about that accurate @ide?
@ide - is that different than what I get in non-Development Mode in XDE? Seems like my app works OK in non-Development Mode from XDE, but doesn’t work when published…
Is the behavior I described above “activity stops, I get the white screen with spinner (just like when initially loading) and then the first screen appears again” - indicative of a hard crash and ‘reboot’ in the Expo client? No red-screen of death, just a quiet reboot…
You also need to turn on minification to faithfully produce the same JS bundle as the published one.
You won’t get the red screen since dev=false disables it. If minification is causing the issue, you could try turning on minification and keeping dev=true and seeing if you get a red box.
throws an exception that I am now catching that appears to be minification related. That is, when I run --no-minify --no-dev the code runs as expected.
Now the question is… how do I find the culprit? Just prune back until I figure out what library isn’t minifying properly? Any tips on that front?
Here’s some guidance from the bitcoinjs-lib guys: " When uglifying the javascript, you must exclude the following variable names from being mangled: Array, BigInteger, Boolean, ECPair, Function, Number, Point and Script. This is because of the function-name-duck-typing used in typeforce. "
Is there a way for me to exclude these symbols from uglification without "eject"ing my project?
OK - here’s how I solved it for now. I used the .babelrc to map the pesky typeforce package to a stubbed version and everything seems to work ok. This is a bit bogus, but since afaik typeforce is only for doing runtime type checking it should be ok - at least until something else forces me to ‘eject’!