-
Notifications
You must be signed in to change notification settings - Fork 445
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 #2136
Comments
I've been putting together a demo that hopefully we can showcase at libp2p Day there's still some work to do, as @achingbrain mentioned a bulk of the work has been polyfill-ing and adapting modules. the goal is to hopefully have two mobile nodes connected via websockets and/or a laptop as well for bonus. |
Is this supported now for React Native in iOS ? Even better if expo can be supported. |
Not yet @anistark I will update this issue once either platform is supported, for now you can track progress at https://github.com/maschad/libp2p-react-native |
The latest patch release of js-libp2p & supporting modules have shipped with some fixes for running under react-native. There's a new demo app at https://github.com/ipfs-shipyard/js-libp2p-react-native which uses Expo to build a simple app with a running libp2p node. It currently supports WebSocket and tcp transports. WebRTC should also work via react-native-webrtc but I'm having some problems - Please try it out and let us know how you get on. |
☝️ cc: @shamilovtim |
Reviewed the demo project, looks like what i'd expect.
I don't use the experimental "exports" support right now so this is the only part of your demo project I'm unsure about. The "react-native" directive is like a scalpel for us while the "exports" is a blunt hammer that caused more harm than good when I tried to use it. |
Thanks for taking a look.
I'm interested in what's still broken here, once I'd fixed up it-ws and a few libp2p modules it was pretty much plain sailing, though granted the dependency tree of the demo is quite small. Certainly turning on exports map support will let you remove all of those custom directives. I do wonder too, if react-native will turn it on by default in the future so it'd be good to get a head start on that.
Looking through the source code @peculiar/webcrypto doesn't do any crypto operations using JS, it uses node's |
My memory is a little foggy here but it caused a cascade of dependency incompatiblities. For instance, package A selects |
Very nice. I actually had no idea this existed. I confused it with a different pure js polyfill (the |
I'm not sure it's of interest here, but I need some |
Given we have Websockets working 🥳 see https://github.com/ipfs-shipyard/js-libp2p-react-native the remaining work is get:
|
I would like to get WebRTC working in react-native. But I get the following error. Edit |
Action item: document which transports work and which ones don't to update the README and then close this. |
Update React Native instructions in config Closes #2136
We'd love to officially support running on React Native.
The requirements for this would be:
There's been some preliminary support added to aegir for running tests under Android but I'm not sure what the current state of the art is in automated testing.
A preliminary pass might just be to get a simple demo react-native app running libp2p working. This might involve a list of required changes to modules to polyfill or replace APIs that do not exist/are buggy/incomplete in React Native.
If it helps to reduce the scope, perhaps a stand-alone repo could be tackled first to prove it out instead of the js-libp2p monorepo.
This was discussed briefly at the js-colo in NYC last week.
Refs:
Demo:
The text was updated successfully, but these errors were encountered: