Skip to content

feat: add react native web support #13

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Robert27
Copy link
Contributor

@Robert27 Robert27 commented Dec 16, 2024

Added support for react native web by adapting the dispatcher behavior from aptabase-js.

  • Created two new dispatcher classes to handle dispatching for each platform.
  • Updated various files to handle the new platform
  • Updated a few dependencies
  • Added and updated the vitest tests.

Resolves #12

@Robert27 Robert27 force-pushed the feat/react-native-web branch from c309c37 to bd56e18 Compare December 16, 2024 17:32
@ivnbogdan
Copy link
Contributor

@Robert27 thank you for your contribution.

Can you please highlight in a comment here the differences in implementation between the two and the reasoning for explicit support for React Native Web?

@Robert27
Copy link
Contributor Author

React Native Web has become increasingly popular, especially since Expo Web. The Bluesky web app, for example, is written with React Native Web. Specifically, I need this feature for my team, and I read the request in the discord. However, this SDK does not yet support the web platform.

Implementing it turned out to be a bit more complicated, as different philosophies were chosen between native and web.
I analyzed the other SDKs and used a comment from the founder in Discord. So web sends the events immediately, because the browser can be closed at any time, but native on the other hand batched to another endpoint, which also has no CORS restrictions.
Consequently, I had to create two dispatchers, one for web to the single event endpoint without user agent, so that CORS works, and the other one is the unmodified native dispatcher

@beshkin
Copy link

beshkin commented Jan 23, 2025

I can absolutely relate on this PR.
@Robert27 great job. I checked the implementation and looks like exactly what we need

@Robert27 Robert27 requested review from beshkin and ivnbogdan May 24, 2025 14:55
@Robert27
Copy link
Contributor Author

Robert27 commented Jun 3, 2025

I have added all the desired changes and the web functionality is now opt-in. I was also able to solve all issues with the tests and also added new ones. In addition I also updated the documentation in the readme accordingly.

My team is already using my fork in production and everything works without any problems.

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.

Add support for react native web
3 participants