a demo integrated u3.js into react native
u3.js
is default to browser and nodejs environments, but you can still integrate u3.js to react native usingrn-nodeify
.
-
for a new react native project,
npm install -g react-native-cli
first and thenreact-native init XXX
. -
npm install -g rn-nodeify
. -
update package.json adding
"postinstall": "rn-nodeify --install --hack",
to the scripts. -
cd XXX
and thennpm install u3.js asyncstorage-down --save
or if you just need the ecc lib for signing,npm install u3-utils --save
-
replace the generated file
shim.js
with the same one in the root of project. -
add
import './shim';
to top position of the entry fileindex.js
. -
refer to
App.js
and use u3.js in react native.
if you have any problem when integrating u3.js to react native,please contact me.