Closed Reizar closed 3 years ago
@Reizar thank you for this PR, I just faced the same issue. As a quick/temporary fix until this PR is merged, is to add this line to your app's entry point:
Object.defineProperty(window.navigator, 'userAgent', { get: () => 'ReactNative' });
This will basically fake a getter method for the userAgent for maybeEncode
to work
@Reizar @bassemawhoob https://github.com/graphiti-api/spraypaint.js/pull/99 looks like this broke specs
window is an object in React Native, so in maybeEncode in parameterize.ts the isBrowser flag is set to true. This then causes a crash as it attempts to check if window.navigator.userAgent.match(/(MSIE|Trident)/) , which throws an error as window.navigator is not defined.
Changing to checking for the presence of document should satisfy the condition of making sure its a browser, while evaluating to false in nodejs and react-native.