inspect icon indicating copy to clipboard operation
inspect copied to clipboard

React Native compatibility

Open kieran-osgood opened this issue 1 year ago • 5 comments

At the moment running inspector in react-native application throws an Error.

 ERROR  TypeError: this.options.window.open is not a function (it is undefined), js engine: hermes

I don't believe it'll be exactly possible to handle opening the browser whilst its running within RN

Could checking for access of window, prior to just opening, and then logging out the url to console be an option to give access as a workaround when working outside of browser

kieran-osgood avatar Jan 05 '24 15:01 kieran-osgood

  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called., js engine: hermes
I don't believe it'll be exactly possible to handle opening the browser whilst its running within RN

Could checking for access of `window`, prior to just opening, and then logging out the url to console be an option to give access as a workaround when working outside of browser

This error commonly occurs when the entry file (index.js or App.js) is not properly specified or the main component is not registered using AppRegistry.registerComponent. To resolve this issue:

  1. Check your entry file (usually index.js or App.js) to ensure that there is a line similar to AppRegistry.registerComponent('Main', () => App) included. Here, 'Main' represents the name of the main component in your React Native application. Adjust this line to match your app's main component if it differs.

  2. Ensure that this registration line is correctly written and properly executed in your entry file. It should define the main component of your application and register it for the React Native framework to recognize it as the starting point of your app.

By confirming the correct registration of your main component within the entry file using AppRegistry.registerComponent, you can resolve the "Invariant Violation: 'main' has not been registered" error in your React Native application.

caltikoc avatar Jan 05 '24 21:01 caltikoc

I've edited the error report to remove those metro violations, those lines were superfluous, that violation occurs due to the preceding error. The app is definitely registered correctly and only errors once adding in the inspector to a machine

kieran-osgood avatar Jan 06 '24 00:01 kieran-osgood

Hi, is there any progress on that?

jahglow avatar Feb 14 '24 07:02 jahglow

Hi, is there any progress on that?

We're working on a websocket inspector adapter in this package that should be used instead.

davidkpiano avatar Feb 14 '24 15:02 davidkpiano

Def a bit hacky, but here's a working fork that works w/RN: https://github.com/tnortman-jabra/stately-inspect/pull/1/files

tnortman-jabra avatar Mar 28 '24 18:03 tnortman-jabra