LinusU / react-native-get-random-values

A small implementation of `getRandomValues` for React Native
MIT License
350 stars 48 forks source link

Problems on react-native #12

Closed ortonomy closed 2 years ago

ortonomy commented 4 years ago

This is really buggy for me while I'm doing react-native development. It only works when remote debugging.

On physical device and simulator.

I can't give further information, because I don't know what you need.

lexengineer commented 4 years ago

Getting the same issue when using with nanoid and have to switch to another library because of that issue.

emclab commented 4 years ago

What is the RN version? I am going to use it on RN 0.63.2.

LinusU commented 4 years ago

@emclab it should work with 0.63.2 👌

If someone could post a repo with a React Native project where this doesn't work I would be happy to take a look!

btd1337 commented 3 years ago

I'm getting this error:

Possible Unhandled Promise Rejection (id: 0):
Error: Native module not found
Error: Native module not found
    at getRandomBase64 (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.abc&modulesOnly=false&runModule=true:312682:22)
    at getRandomValues

Macbook M1 Air Pro: 2021 React Native: 0.65.1 react-native-get-random-values: 1.7.0

LinusU commented 3 years ago

@btd1337 did you run npx pod-install in your project after installing this package?

GrandPoohBear commented 2 years ago

I'm encountering a similar issue. @LinusU - I definitely ran npx pod-install, and while I can clearly see the podspec file in my node_modules directory, it doesn't seem to be present in the Podfile.lock after I run the install.

I was able to remedy the issue by explicitly referring to the directory in my Podfile:

pod 'react-native-get-random-values', :path => '../node_modules/react-native-get-random-values/'

... after which I'll see a line like this in the output:

Installing react-native-get-random-values (1.7.1)

Not at all sure why that's happening!

Choyeongdeok commented 2 years ago

npm i react-native-get-random-values

cd ios && pod install

quit the current project and added import 'react-native-get-random-values' at the top of index.js

and then react-native run-ios -- --reset-cache

LinusU commented 2 years ago

Happy to reopen if people are still having problems, but I don't have enough information to debug this. Creating a new React Native project and adding this module works for me...

ddtch commented 1 year ago

same here; tried everything, got error

 ERROR  [Error: Native module not found]
LinusU commented 1 year ago

same here; tried everything [...]

"Tried everything" doesn't really give me much to work with. Did you try to create a new clean React Native project and adding this module?

error-try-again commented 1 year ago

I was having the same issue but for Android. I solved it by following these steps:

-> added import react-native-get-random-values' beneath import App from './App' in index.js -> confirmed it was defined in my package.json and up to date -> gradle clean -> react-native run-android -> react-native start --reset-cache

purellarohith commented 9 months ago

image

Hi all am still getting same error. Can anyone help me.