React-Native: App stuck when debuggin unless screen is clicked

Question!

My Android App consists of two Screens: "Login" and "Dashboard". The Login works just fine but the Dashboard is a troublemaker.

First Problem:

On the Login Screen I can open the debug menu and everything works as expected. When I switch to the Dashboard screen I cannot open the menu anymore. If I enabled the Inspector in the Login screen and then go to the Dashboard screen, the Inspector disappears.

Second Problem:

When I run the App without an attached debugger I get no Data in the Dashboard but the Login works as usual.

When I attach the debugger the App gets "stuck" a lot. By clicking the screen (with attached debugger) when it is "stuck" the App sort of moves a step forward - When i click the screen often enough I end up with all the data I was expecting! There are NO breakpoints set and I don't need to use the debugger at all, it just has to be attached.

The iOS counterpart seems to work just perfectly fine.

What could be wrong here?

Update:

Im using React-Native 0.31.0

Just to clarify: My problem is not the debugger in itself. My problem is the fact, that I get no data without debugger but get all the data, when the debugger is attached (on Android only!).



Answers

I believe to have figured out what the core of the problem was.

When debugging a React-Native App, the code is "run" by your Chrome which supports more of the javascript. (I find it hard to find the proper words for this...)

From the React-Native documentation :

On iOS simulators and devices, Android emulators and devices React Native uses JavaScriptCore which is the JavaScript engine that powers Safari. On iOS JSC doesn't use JIT due to the absence of writable

executable memory in iOS apps. When using Chrome debugging, it runs all the JavaScript code within Chrome itself and communicates with native code via WebSocket. So you are using V8

In my case it were some functions that used for of loops or the array.some syntax.

I am not sure, what is currently supported by now so you (who ever comes across this problem) may want to update your react-native version.

Please see this ECMAScript Compatibility table



This video can help you solving your question :)
By: admin