LinusU/react-native-get-random-values

null is not an object (evaluating 'RNGetRandomValues.getRandomBase64')

danielreptar opened this issue ยท 9 comments

Hello, i have this problem
image

I already put in my index.js
import "react-native-get-random-values";

this is my packaje.json
package-json

Did you run these commands?

cd ios && pod install && cd ..

Are you running with Expo?

@LinusU same problem, on Android

Nvm, did not rebuild app after installing this package.

@danielreptar it seems from your package.json that you are using Expo, please react with a thumbs-up on the following issue to indicate that you would like this supported in Expo:

expo/expo#7209

i eject the project from expo, and only use for Android

@LinusU I'm still getting this issue only on Android, on a project not using expo. Below is my package.json. Any thoughts on getting it to run?

{
  "name": "MobileApp",
  "version": "0.0.5",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "android": "cd ./android && ./gradlew app:assembleDebug && ./gradlew installDebug",
    "build:docs": "./docs/gendocs.sh",
    "setenv": "node setenv.js"
  },
  "dependencies": {
    "babel-core": "^7.0.0-bridge",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "bad-words": "^3.0.0",
    "memoize-state": "^2.0.4",
    "moment": "^2.22.2",
    "moment-timezone": "^0.5.23",
    "number-to-words": "^1.2.4",
    "numeral": "^2.0.6",
    "pluralize": "^8.0.0",
    "prop-types": "^15.6.2",
    "react": "16.8.3",
    "react-native": "0.59.10",
    "react-native-animate-number": "^0.1.2",
    "react-native-branch": "^3.1.1",
    "react-native-check-box": "^2.1.6",
    "react-native-code-push": "^5.6.0",
    "react-native-collapsible": "^1.5.1",
    "react-native-communications": "^2.2.1",
    "react-native-datepicker": "^1.7.2",
    "react-native-device-info": "2.1.2",
    "react-native-fast-image": "6.0.3",
    "react-native-fbsdk": "^0.8.0",
    "react-native-firebase": "^5.0.0",
    "react-native-get-random-values": "^1.4.0",
    "react-native-google-signin": "^2.0.0",
    "react-native-idfa": "^4.1.0",
    "react-native-image-crop-picker": "^0.21.3",
    "react-native-intercom": "13.1.0",
    "react-native-iphone-x-helper": "^1.2.0",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-kochava-tracker": "^1.1.0",
    "react-native-navigation": "^2.19.0",
    "react-native-permissions": "^1.1.1",
    "react-native-responsive": "^1.0.2",
    "react-native-scalable-image": "^0.4.0",
    "react-native-scrollable-tab-view": "^0.9.0",
    "react-native-section-list-get-item-layout": "^2.2.3",
    "react-native-sentry": "^0.42.0",
    "react-native-simple-picker": "^3.1.1",
    "react-native-smooth-pincode-input": "^1.0.3",
    "react-native-social-share": "^1.6.4",
    "react-native-svg": "^9.4.0",
    "react-native-swiper": "^1.5.13",
    "react-native-text-ticker": "^0.13.0",
    "react-native-triangle": "^0.0.9",
    "react-native-vector-icons": "^6.1.0",
    "react-native-video": "^4.4.1",
    "react-redux": "^5.0.7",
    "redux": "^4.0.1",
    "redux-logger": "^3.0.6",
    "redux-persist": "^5.10.0",
    "redux-thunk": "^2.3.0",
    "requirejs": "^2.3.6",
    "text-encoding": "^0.7.0",
    "underscore": "^1.9.1"
  },
  "devDependencies": {
    "@babel/core": "^7.4.5",
    "@babel/runtime": "^7.4.5",
    "babel-jest": "^24.8.0",
    "documentation": "^8.1.2",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.54.1",
    "react-doc-generator": "^1.2.5",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts"
    ]
  }
}

@opetroulas I would recommend updating to the latest React Native version which has auto-linking, which should fix your issue... Otherwise you could try following the documentation on manual linking for previous versions of React Native...

@LinusU i have the same issue on the latest RN version - trying on Android device.

"react-native": "0.62.2",

Question: could react-native-get-random-values be installed by a nested dep? Or it must be installed by the end user on their own react-native Apps?
^ I mean for the auto-linking process maybe?

I have the same situation with @opetroulas and I have been using the latest version of react-native 0.62.2. And where is the linking document

Same issue:

"react-native": "0.63.2",

Linking appears to work correctly, still receiving issue after wiping node_modules and Pods, reinstalling both. Not using Expo