1

In React native project uuid library giving runtime error

Error: crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported

deepanshu katyal
  • 631
  • 1
  • 8
  • 18

1 Answers1

6

"getRandomValues() not supported"

This error occurs in environments where the standard crypto.getRandomValues() API is not supported. This issue can be resolved by adding an appropriate polyfill:

React Native

Install react-native-get-random-values
Import it before uuid:
import 'react-native-get-random-values';
import { v4 as uuidv4 } from 'uuid';
deepanshu katyal
  • 631
  • 1
  • 8
  • 18