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

React Native support #170

Closed
2 of 3 tasks
saulmc opened this issue Sep 22, 2022 · 4 comments
Closed
2 of 3 tasks

React Native support #170

saulmc opened this issue Sep 22, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@saulmc
Copy link
Member

saulmc commented Sep 22, 2022

Context

Attempting to use xmtp-js in React Native will produce errors relating to ethers missing modules,BigInt type conversion, and missing crypto APIs.

Problem

Developers cannot use XMTP in React Native.

Goal

Unblock developers from developing with React Native by providing a proof-of-concept React Native example using xmtp-js.

Resolution

@saulmc saulmc added the enhancement New feature or request label Sep 22, 2022
@hiteshjoshi1
Copy link

I tried using Hermes but still get the BigInt issue, how did you resolve it. I would really appreciate exact steps.
I am assuming that until Missing crypto APIs is resolved, xmtp-js will not work for react-native. Is that correct?

@elisealix22
Copy link
Contributor

@hiteshjoshi1 thank you for the questions!

I tried using Hermes but still get the BigInt issue, how did you resolve it.

BigInt was added to Hermes in the version bundled with React Native 0.70. However even on v0.70, it seems the Babel presets transform BigInt's into numbers causing a TypeError. To resolve that, we pass a hermes-stable param to the metro-react-native-babel-preset in our babel.config.js.

I am assuming that until Missing crypto APIs is resolved, xmtp-js will not work for react-native.

We have a working demo showcasing how xmtp-js can be used today, but the SubtleCrypto library we use is only for experimental purposes so we're working to remove that dependency. In the meantime, we can only recommend the demo be used for experimental purposes as well. Hope that helps clear that up!

@hiteshjoshi1
Copy link

Thanks, I upgraded my app to react v0.70 and still had the issue. But, I have not tried -
we pass a hermes-stable param to the metro-react-native-babel-preset in our [babel.config.js](https://github.com/xmtp/example-chat-react-native/blob/19f47c4b725aeefe04dfdea97fa83097bbe6e527/babel.config.js#L6).
I tried the working demo and I was able to send messages. I will wait for the SubtleCrypto dependency to be removed before looking to integrate with xmtp-js

@nplasterer nplasterer assigned rygine and dmccartney and unassigned rygine Feb 15, 2023
@rygine
Copy link
Collaborator

rygine commented Nov 28, 2023

now that we have a proper react native SDK, closing this issue.

@rygine rygine closed this as completed Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants