ipfs / helia

An implementation of IPFS in JavaScript
https://helia.io
Other
916 stars 95 forks source link

React-native support? #435

Closed sleep9 closed 6 months ago

sleep9 commented 7 months ago
const node = await createNode(relayAddrs,pid); // libp2p
 const datastore = new MemoryDatastore()
 const ipfs = await createHelia({ datastore,libp2p:node }) 

Getting the following error when trying to create an instance of helia. "Your javascript code tried to access a native module that doesnt exist in this development client"

Maybe someone can reproduce this error. Not sure what needs to be polyfilled or what native library is needed. Tried rm -rf ./node_modules, npm install, pod deintegrate && pod install but no luck. Tried "postinstall": "rn-nodeify --install events --hack" no luck.

achingbrain commented 7 months ago

There are some polyfills/config that need to be set up to modernise the React Native environment - it's documented here - https://github.com/ipfs-shipyard/js-libp2p-react-native

Could you try building from that project, then adding Helia to it to see what extra stuff is needed?

sleep9 commented 7 months ago

I started from a git clone of that repository. Here is the error, I thought it might be events but I was wrong.

Screenshot 2024-02-15 at 09 33 22
sleep9 commented 6 months ago

The native module required was react-native-webrtc.