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

Handle window.location undefined #38

Closed
wants to merge 1 commit into from

Conversation

daniel-shuy
Copy link

Fixes #25

window.location is undefined in React Native

window.location is undefined in React Native
@bluepnume
Copy link
Collaborator

Hi -- thanks for the fix, but isn't this already covered by isBrowser()?

@daniel-shuy
Copy link
Author

No, isBrowser() only checks whether window is undefined, not window.location. React Native polyfills window, but not window.location (see https://github.com/facebook/react-native/blob/v0.63.3/Libraries/Core/setUpGlobals.js#L21-L23)

@daniel-shuy
Copy link
Author

Or should I create a PR to update isBrowser() to check for window.location instead?

@bluepnume
Copy link
Collaborator

Gotcha. In that case would you mind making the fix in isBrowser() instead since the current implementation doesn't cover that react native case? Thanks!

@daniel-shuy
Copy link
Author

Done (krakenjs/belter#11)

@daniel-shuy daniel-shuy closed this Oct 6, 2020
@daniel-shuy daniel-shuy deleted the patch-1 branch October 6, 2020 07:37
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.

React Native - window.location.protocol undefined
2 participants