Steps to reproduce:
create-react-native-app proj && cd proj && npm i
Installing package that is using crypto. Performing steps listed at https://www.npmjs.com/package/react-native-crypto :
npm i -S react-native-crypto && npm i -S react-native-randombytes
react-native link react-native-randombytes
Got a warning for react-native link failure, however after the following hack crypto dependancy is no longer a problem:
npm i --save-dev tradle/rn-nodeify
./node_modules/.bin/rn-nodeify --hack --install
Adding import './shim.js'
into the App.js
yarn run ios
Got a problem like here: https://github.com/mvayngrib/react-native-randombytes/issues/13
undefined is not an object (evaluating 'RNRandomBytes.seed')
I can't update npm and node due to some of the used package restrictions
MacOS 10.12, Node 8.0.0, npm 5.0
EDIT:
RNRandomBytes are initialized as let RNRandomBytes = require('react-native').NativeModules.RNRandomBytes
init
is the first place where RNRandomBytes is accessed in react-native-randombytes imported from react-native-crypto imported from twitter nacl
EDIT2: After creating project via react-native init
linking phase completed successfully:
rnpm-install info Linking react-native-randombytes android dependency
rnpm-install info Android module react-native-randombytes has been successfully linked
rnpm-install info Linking react-native-randombytes ios dependency
rnpm-install info iOS module react-native-randombytes has been successfully linked
import './shim.js'
for this sample project is in the index.js instead of App.js
But the error was the same