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: improve global window checks to enable react native support #823

Merged
merged 1 commit into from
May 16, 2024

Conversation

Amorim33
Copy link
Contributor

@Amorim33 Amorim33 commented May 16, 2024

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:

WhatsApp Image 2024-05-15 at 23 53 56

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

@Amorim33 Amorim33 force-pushed the react-native-expo-support branch from 234b88c to f7d454d Compare May 16, 2024 03:10
@janthurau janthurau merged commit 5dd53d5 into ueberdosis:main May 16, 2024
3 checks passed
@janthurau
Copy link
Collaborator

@Amorim33 Thanks so much for making us compatible with Expo :-)

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.

2 participants