XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.2k stars 510 forks source link

Ripple-lib with react native #775

Closed Kishanjvaghela closed 3 years ago

Kishanjvaghela commented 7 years ago

Can I use this lib with react native?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/46625517-ripple-lib-with-react-native?utm_campaign=plugin&utm_content=tracker%2F323756&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F323756&utm_medium=issues&utm_source=github).
intelliot commented 6 years ago

Yes.

emilbaekdahl commented 6 years ago

How so? I have built the single JS file according to the instructions but I get _ is not defined even though I import lodash before ripple-lib - like so

import _ from 'lodash'
import '../lib/ripple-0.17.9'

How is this done properly, @intelliot ?

allmaxgit commented 6 years ago

I have Super expression must either be null or a function, not object error.

astone123 commented 6 years ago

I'm having trouble importing this library into my React Native project. I'm getting an error that node_modules/ripple-lib/dist/api.js is trying to require a module called "event" that does not exist in the module map.

This is how I'm importing import { RippleAPI } from 'ripple-lib';

Not sure if this is a React Native issue or an issue with this library. Is anyone else having this problem?

FredKSchott commented 6 years ago

I'm not familiar enough with react-native to debug this too deeply, but it looks like Node.js/NPM packages aren't completely plug-and-play on react-native. For example, "events" module not found is because "events" is a Node.js core module, so it makes sense that this would fail when run outside of Node.

It would be great if someone with more react-native experience could give some guidance here. For example, should this be solved via:

mszczech01 commented 5 years ago

I'm having trouble importing this library into my React Native project. I'm getting an error that node_modules/ripple-lib/dist/api.js is trying to require a module called "event" that does not exist in the module map.

This is how I'm importing import { RippleAPI } from 'ripple-lib';

Not sure if this is a React Native issue or an issue with this library. Is anyone else having this problem?

I'm experiencing this issue as well. Have you managed to find a work around?

reneveyj commented 5 years ago

After hours of research and testing I found a way to integrate ripple-lib in React Native and created a boilerplate project with a demo and a description of the steps I took to make it work: https://github.com/reneveyj/RNRippleLib

elmurci commented 3 years ago

FYI - I have created a PR https://github.com/ripple/ripple-lib/pull/1341 to update instructions on how to use ripple-lib with React Native.

intelliot commented 3 years ago

Fixed by #1387. Instructions are in the README.