Skip to content

clojurescript react-native web3 using re-natal without lein dependency

License

Notifications You must be signed in to change notification settings

babyjazz/clojurescript-reactnative-web3

Repository files navigation

How to use web3.js v.1.x.x in clojurescript using re-natal without clojurescript dependency

Environment

  • Nodejs v.8+ # Test in node v.10.9.0
  • react-native-cli v.2.0.1
  • react-native v.0.55.4
  • re-natal v.0.9.0
  • Leiningen 2.8.1 on Java 1.8.0_181 Java HotSpot(TM) 64-Bit Server VM

Installatin

yarn
./node_modules/.bin/rn-nodeify --hack --install

How to start

rlwrap lein fighweel android
react-native run-android

Full installation and start from start project

re-natal init project
cd project
yarn
re-natal use-android-device avd  # Learn more: https://github.com/drapanjanas/re-natal
yarn add -D babel-preset-es2015
yarn add web3
re-natal require web3 android
re-natal use-figwheel
yarn add react-native-crypto react-native-randombytes
react-native link react-native-randombytes

# Do two commands twice if getting error in first times
yarn add -D tradle/rn-nodeify
./node_modules/.bin/rn-nodeify --hack --install

re-natal require ./shim.js android
re-natal require ./global.js android
re-natal require crypto android

# Edit ios/android core.cljs at top of require package
(js/require "./shim.js")
(js/require "./global.js")
(js/require "crypto")

rlwrap lein figwheel android
react-native run-android

build production

lein prod-build

then do following react native build production document

NOTE

You can use short installation by this following https://gist.github.com/dougbacelar/29e60920d8fa1982535247563eb63766 and https://stackoverflow.com/questions/52697108/unable-to-resolve-module-crypto-in-reactnative/52698050#52698050 and use (js/require "shim and global and crypto") instead of import