Closed obasille closed 1 year ago
For anyone who stumble on this problem, I found the root cause:
expo-three is importing @expo/browser-polyfill which changes the user agent to "chrome" => navigator.userAgent = 'chrome'.
Some libraries that target both the web and React Native check the user agent before using HTMLElement. In a normal React Native context the user agent is undefined and those libraries don't use any web specific classes. But once the user agent is changed to "chrome", the library will think it's running in a web environment (and in my case it will use HTMLElement).
Note : I was wrong to think that HTMLElement should exist in React Native.
I've stumbled into a strange issue, using Three in a Expo project causes
HTMLElement
to become undefined.I don't use of
HTMLElement
since I'm targeting mobile only, but some packages that I'm using do and as soon I'm starting to use Three I'm getting this error:For example some packages might run this code
ref instanceof HTMLElement
which normally works fine in a Expo project, until you start using Three.For example this simple app will immediately crash:
package.json
Any help would be greatly appreciated!