React-native: Unless click on the screen, the application will be attacked when debugging

My Android application contains two screens: “Login” and “Dashboard”.
Login works fine, but the dashboard is a troublemaker.

< /p>

First question:

On the login screen, I can open the debug menu and everything works as expected. When I switch to the dashboard screen, I can no longer open the menu. If I enable the inspector in the “Login” screen and then go to the “Dashboard” screen, the inspector will disappear.

Second question:

When I run the application without the debugger connected, I have no data in the dashboard, but the login works fine.

When I attach the debugger, the App will “stuck” a lot.
By clicking on the screen (with debugger attached), when it “stuck”, the App class moves one step forward-when I frequently click on the screen, I finally got all the data I was expecting!
No breakpoints are set, I don’t need to use the debugger at all, just attach it.

The iOS counterpart seems to be completely normal.

What could be wrong with this?

Update:

I use React-Native 0.31.0

Just to clarify: my question itself is not a debugger. My question is the fact that , That is, I don’t have data without a debugger, but I get all the data when the debugger is connected (Only on Android!).

I believe I have figured out what the core of the problem is.

When debugging React-Native App, Chrome will “run” the code and support more javascript . (I find it difficult to find the right word…)

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.< br> 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 example , It is some function for loop or array.some syntax.

I’m not sure, what is supported now, so you (people who have encountered this problem) may want to update your react- Native version.

Please refer to this ECMAScript Compatibility table

My Android application contains two screens: “Login” and “Dashboard”.
Login works fine, but The dashboard is a troublemaker.

First question:

On the login screen, I can open the debug menu and everything works as expected. When I switch When I get to the dashboard screen, I can no longer open the menu. If I enable the inspector in the “Login” screen and then go to the “Dashboard” screen, the inspector will disappear.

The second Question:

When I run the application without the debugger connected, I have no data in the dashboard, but the login works fine.

When I attach the debugger , App will “stuck” a lot.
By clicking on the screen (with debugger), when it “stuck”, the App class moves one step forward-when I frequently click on the screen, I finally got what I expected All the data!
No breakpoints are set, I don’t need to use the debugger at all, just attach it.

The iOS counterpart seems to be completely normal.

What could be wrong with this?

Update:

I use React-Native 0.31.0

Just to clarify: my question itself is not a debugger. My question is the fact that , That is, I have no data without a debugger, but all data is obtained when the debugger is connected (Only on Android!).

I believe I have figured out what the core of the problem is.

When debugging React-Native App, Chrome will “run” the code and support more javascript. (I find it difficult to find the right word… )

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 example, it is some for loop or array.some Syntax function.

I’m not sure, what is supported now, so you (people who have encountered this problem) may want to update your react-native version.

See this ECMAScript Compatibility table

Leave a Comment

Your email address will not be published.