Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error for react native #1

Merged
merged 1 commit into from
Apr 12, 2022
Merged

Fix error for react native #1

merged 1 commit into from
Apr 12, 2022

Conversation

ergenekonyigit
Copy link
Contributor

@ergenekonyigit ergenekonyigit commented Apr 12, 2022

The value of the window.navigator.product property is always Gecko, in any browser.
However, in react native window.navigator.product returns ReactNative.

// react native window object
{
  "console": { "reportErrorsAsExceptions": true },
  "__jsiExecutorDescription": "HermesRuntime",
  "nativeModuleProxy": {},
  "_WORKLET_RUNTIME": 105553139337248,
  "__reanimatedModuleProxy": {},
  "__BUNDLE_START_TIME__": 127407015.3367917,
  "__DEV__": true,
  "process": { "env": { "NODE_ENV": "development" } },
  "__METRO_GLOBAL_PREFIX__": "",
  "originalConsole": {},
  "ErrorUtils": {},
  "performance": {},
  "regeneratorRuntime": {},
  "originalRegeneratorRuntime": {},
  "navigator": { "product": "ReactNative" },
  "__SYSTRACE": {},
  "__ReactRefresh": {},
  "REACT_NAVIGATION_DEVTOOLS": {},
  "__react_navigation__elements_contexts": {}
}

So with this field, we can distinguish the browser and fix this issue.

Before

image

image

After

image

image

@shuding shuding merged commit 8f71d52 into shuding:main Apr 12, 2022
@shuding
Copy link
Owner

shuding commented Apr 12, 2022

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants