On React-Native, how can I know if "Debug JS Remotely"
is enabled?
I tried looking in RN docs and various NPM packages, but couldn't find out how...
You can also use the ⌘D keyboard shortcut when your app is running in the iOS Simulator, or ⌘M when running in an Android emulator on Mac OS and Ctrl+M on Windows and Linux. Alternatively for Android, you can run the command adb shell input keyevent 82 to open the dev menu (82 being the Menu key code).
Open the developer menu in Chrome and select “Debug JS Remotely” to debug JavaScript code. This will open http://localhost:8081/debugger-ui in a new tab.
If you are using on MS : ctrl + m , MAC OS : cmd + m , iPhone/android: shake your device then look for the "disable Remote Debug JS" and click it. Show activity on this post. Go to your android settings and clear app data and cache and reload the app remote debugging will be turned off.
When debugging a React app, I often find breakpoints to be very helpful. There are two main ways in which we can use them: By writing the debugger statement in our source code. By clicking on a specific line of the code in the Chrome web browser (or Firefox, Edge, etc.)
How to programmatically check if remote debugging is enabled (just found this peculiar behaviour today on another SO question). Tested on RN 0.43 and with Chrome debugger + React Native Debugger :
const isDebuggingEnabled = (typeof atob !== 'undefined');
Edit: just noticed this was asked over half a year ago :D... well, I leave it here for future generations.
A class DedicatedWorkerGlobalScope
exists iff remote debugging is enabled (it is the constructor of global object in that case). Thus we can:
const haveRemoteDev = (typeof DedicatedWorkerGlobalScope) !== 'undefined';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With