![]()
React bitcoinjs - consider, that
rn-nodeify
Run after npm install and you can use node core modules and npm modules that use them in your React Native app.
What is solves
If your project has no non-React-Native dependencies, you don't need this module, and you should just check out './shims.js' for the core node modules to use individually.
However, with bigger projects that don't reimplement every wheel from scratch, somewhere in your dependency tree, something uses a core node module. I found myself building this because in my React Native app, I wanted to use bitcoinjs-lib, levelup, bittorrent-dht, and lots of fun crypto. If that sounds like you, keep reading.
What it does
installs shims for core node modules, see './shims.js' for the current mappings. It recurses down and modifies all the 's in there to add/update the and fields. It sounds scary because it is. However, it does work.
Now that you're scared, I should also mention that there are some package-specific hacks (see './pkg-hacks.js'), for when the React Native packager choked on something that Webpack and Browserify swallowed.
If you're looking for a saner approach, check out ReactNativify. I haven't tested it myself, but I think philikon will be happy to help.
Usage
Options
Examples
It is recommended to add this command to the "postinstall" script in your project's package.json
rn-nodeify will create a file in your project root directory. The first line in index.ios.js / index.android.js should be to it (NOT it!)
If you are using the crypto shim, you will need to manually uncomment the line to in , this is because as of react-native 0.49, dynamically requiring a library is no longer allowed.
Some shims may require linking libraries, be sure to run after installing new shims if you run into problems.
Example Apps / Workflows
Example Workflow
copied from react-native-crypto
Install and shim
will create a in the project root directory
Please note...
0 thoughts to “React bitcoinjs”