React - When debugging in chrome, get a "document not defined" error

I am trying to debug a React Native iOS project in Chrome and I am getting a stack trace document is not defined. When I turn off chrome debugging, the application works fine. I am using response-native 0.14.2 in my package. Json When I try to enable debugging for any of the sample applications, I get the same error in chrome. I just checked the response structure from github, so I do not use the "respond to native" commands. Any ideas what might be wrong here? Below is a red square to display my screen when Chrome Debugging is enabled. React the image from Redbox below. Thanks!

When I check the stack trace in chrome debugging, this is the line it throws at:

require("react-native/Examples/ViroSample/ViroSampleApp.ios.js");

Here is the full stack trace:

Document not defined
Descriptor Exception @ ExceptionsManager.js: 63
handleError @ InitializeJavaScriptAppEngine.js: 80
ErrorUtils.reportFatalError @ error-guard.js: 28
requireImpl @ require.js: 31
require @ require.js: 21
(Anonymousfunction) @ ViroSampleApp .js.js: 1
messageHandlers.executeApplicationScript @ debuggerWorker.js: 18
onmessage @ debuggerWorker.js: 42


Update
The violation code is as follows in ReactErrorUtils.js, which is part of the haste response module:

if (__DEV__) {
  /**
   * To help development we can get better devtools integration by simulating a
   * real browser event.
   */
  if (typeof window !== 'undefined' &&
      typeof window.dispatchEvent === 'function' &&
      typeof Event === 'function') {
    var fakeNode = document.createElement('react');
    ReactErrorUtils.invokeGuardedCallback = function(name, func, a, b) {
      var boundFunc = func.bind(null, a, b);
      fakeNode.addEventListener(name, boundFunc, false);
      fakeNode.dispatchEvent(new Event(name));
      fakeNode.removeEventListener(name, boundFunc, false);
    };
  }
}

xLuRf.png

+4
1

( 0.14.2) , node (rm -rf node_modules && npm install) (rm -rf $TMPDIR/react-*) .

0

Source: https://habr.com/ru/post/1618512/


All Articles