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 compatibility issue with React Native environment #220

Merged
merged 2 commits into from
May 25, 2023
Merged

Fix compatibility issue with React Native environment #220

merged 2 commits into from
May 25, 2023

Conversation

kimskovhusandersen
Copy link
Contributor

This is to improve the compatibility with React Native and ensure the dispatch function is triggered correctly.

Currently, the code assumes the availability of the "window" object without checking its type, which is causing an issue with the dispatch function in React Native where "window" is not present. 🙅‍♂️

To fix this, I have added a simple check to ensure the "window" object is defined using typeof window === "undefined". This allows the code to gracefully handle React Native environments and ensures the dispatch function works smoothly in web browser environments. 🚀

Thank you so much for your time and consideration. 🙏

Copy link
Collaborator

@tizmagik tizmagik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense. Thank you!

@tizmagik tizmagik merged commit bb91f41 into nytimes:main May 25, 2023
@kimskovhusandersen kimskovhusandersen deleted the fix/react-native-support branch May 25, 2023 07:04
@kimskovhusandersen
Copy link
Contributor Author

Great, thank you! 🙏 👍

Just out of curiosity, when can we expect the next release of the library with the recent changes to be published on NPM?

Much appreciated!

@tizmagik
Copy link
Collaborator

Released in v9.3.2

@kimskovhusandersen
Copy link
Contributor Author

Amazing! Thank you very much 👍 🙏

@anna-rusk
Copy link

What version of React/React Native are you on? I am seeing this error when using react: 18.2.0 and react-native: 0.71.8 and am using the latest patch v9.3.2 of this package
Screenshot 2023-06-08 at 3 29 02 PM

@tizmagik
Copy link
Collaborator

tizmagik commented Jun 9, 2023

@anna-rusk that looks like a different error entirely. Mind opening up a new issue with more context? Thanks.

@anna-rusk
Copy link

I had this issue open! It was closed recently but I am still facing this issue - I will post more context there

#218

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.

3 participants