fix: improve global window checks to enable react native support #823
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request was opened to address the "window.addEventListener is not a function" error when trying to run Hocuspocus provider on mobile, using Expo.
Currently:
After changes:
WhatsApp.Video.2024-05-15.at.23.39.12.mp4
Context
After watching Evan Bacon's talk about Expo Router v3 at React Conf, I got so inspired to test real-time collaboration using Expo.
Since I am already familiar with it, why not trying hocuspocus?
To make it happen, I just needed to use a NodeJS Crypto polyfill and fix this "window" bug.
Here is the full code of the working proof of concept:
https://github.com/qwikens/qwikens-native