expo native modules do not work correctly with chrome debugger

  1. SDK Version: 47.0.13
  2. Platforms(Android/iOS/web/all): iOS

I was working through the expo native modules tutorial, got it working as expected, and then I tried moving it over to live inside my own project. When I went to log out the getTheme() response to make sure that I had everything set up correctly, it returned a promise. Spent the better part of 2 days trying to figure out what I was doing wrong.

Turns out that it’s an issue when debugging in Chrome’s debugger. You can even see with the working example from the tutorial that the same thing happens if you try to use the debugger when opening it via the simulator (turns out Hermes isn’t on for the tutorial example). As soon as the Chrome debugger gets turned on, the return value of getTheme is a promise instead of the ‘settings’ string that it’s supposed to be.

Once I realized the problem, I came across this post that says the same: getLocales() returns a promise rather than an array as specified in the types when using devlient client and react native debugger. I further confirmed it wasn’t just the example, by installing a different expo native module (expo-camera) and trying to get a value from a function inside that module. Same result - promise, not value

Is there a good workaround for this other than switching to Hermes or having a lot of async calls for development? Using Hermes, this works as expected and spits out a value, but my team’s project isn’t ready for Hermes yet so that isn’t really an option. As to the async calls, that would really be a headache to switch functions to async and return a resolved promise any time we want to debug something.

Thanks for the tip about using Hermes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.