RN uses Chrome for debugging

background

The react_native_debugger often crashes, and other debugging tools don’t work very well either. Chrome is good for debugging, but has two problems:

  1. Browser cross-domain problems

  2. Network does not show the interface requesting a response

As shown in the figure:

The solution

Cross domain:
  1. The browser’s xx. Xx. Xx. Xx: 8081 / debugger – UI… http://localhost:8081/debugger-ui/ to localhost mode

  2. Download cross-domain extensions for Chrome, such as CORS Unblock. Add the extension, turn it on, and use it. For details, see add0n.com/access-cont…

If the response data in the Network panel still cannot be viewed:

Try in App. Js (or index. Android. Js/index. The ios. Js) file add the following code:

global.XMLHttpRequest = global.originalXMLHttpRequest || global.XMLHttpRequest;
Copy the code

The effect

advice

Warning Remote debugger is in a background TAB which may cause apps to perform slowly.

Try opening the debug TAB in a new window to make it faster.