Skip to content

Add React Native support to the Typescript SDK #2955

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 2 commits into
base: master
Choose a base branch
from

Conversation

JulienLavocat
Copy link
Contributor

@JulienLavocat JulienLavocat commented Jul 18, 2025

This PR helps to support React Native in the Typescript SDK. We have identified two issues:

  1. Certain versions of React Native exhibit a bug where the constructor mistakenly treats a URL object as a string. This causes an error when the constructor attempts to call .endsWith() on the URL object, leading to runtime errors. This PR adds a .toString() call when passing a URL instance to the URL constructor.
  2. React Native doesn't provide an implementation for TextEncoder and TextDecoder which are used to read/write strings in our binary reader and writer. This PR use introduce the usage of a library for these two types.

Note: this still requires the use of a Polyfill as React Native URL implementation is missing most methods in version older than 0.79 (>= 6 month old)

@JulienLavocat JulienLavocat force-pushed the jlvc/fix-react-native branch from 4b0ab04 to f2440d7 Compare July 18, 2025 16:59
@bfops bfops added release-any To be landed in any release window bugfix Fixes something that was expected to work differently labels Jul 21, 2025
@JulienLavocat JulienLavocat force-pushed the jlvc/fix-react-native branch from fefceb9 to f2440d7 Compare July 21, 2025 19:44
@JulienLavocat JulienLavocat changed the title fix(ts-sdk): use toString() to allow older react native versions to work Add React Native support to the Typescript SDK Jul 21, 2025
@jdetter jdetter requested a review from jsdt July 22, 2025 17:26
@JulienLavocat JulienLavocat force-pushed the jlvc/fix-react-native branch from aca3e88 to 1f01905 Compare July 23, 2025 09:38
@JulienLavocat JulienLavocat force-pushed the jlvc/fix-react-native branch from 1f01905 to 9969a29 Compare July 23, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes something that was expected to work differently release-any To be landed in any release window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants