react-native-uuid is a robust, zero-dependency TypeScript implementation of the RFC4122 standard for generating Universally Unique Identifiers (UUIDs). It is specifically designed and optimized for React Native environments, ensuring compatibility across various JavaScript runtimes, including Node.js and browsers. The library is currently stable at version 2.0.4, with a development focus on performance, security, and standards compliance. A significant rewrite in version 2.0.0 introduced a pure TypeScript codebase and eliminated external dependencies. Recent updates, such as v2.0.4, have focused on improving the random number generation (RNG) by ensuring compatibility with `crypto.getRandomValues()` API, enhancing security and randomness quality. The package includes comprehensive test suites and continuous integration benchmarks for performance and security metrics, distinguishing it from libraries that might rely on less secure `Math.random` implementations for entropy.
npm install react-native-uuidVerified import paths — ran on the pinned version, not inferred.
Demonstrates generating different UUID versions (v4 and v1) using both default and named imports within a React Native functional component, showing how to update state with new UUIDs.
Review migration guides or package documentation when upgrading from 1.x. Specific fixes for default exports were provided in v2.0.1, so ensure your import statements are aligned with the new API surface.
Ensure your import statements correctly handle the default export, which is an object containing UUID generation methods (e.g., `import uuid from 'react-native-uuid'; uuid.v4();`). Review `ARCHITECTURE.md` for correct import patterns.
Upgrade to `react-native-uuid` version 2.0.4 or newer. For environments where `crypto.getRandomValues()` is still unsupported (e.g., specific React Native versions or debugging with Chrome), consider installing a polyfill like `react-native-get-random-values` and importing it at your app's entry point (`import 'react-native-get-random-values';`).
Use `import uuid from 'react-native-uuid';` and then call `uuid.v4();` OR use the named import `import { v4 } from 'react-native-uuid';` and then call `v4();`.Ensure you are on `react-native-uuid` version 2.0.4 or newer. If the error persists, install `react-native-get-random-values` (`npm install react-native-get-random-values`) and add `import 'react-native-get-random-values';` at the very top of your application's entry file (e.g., `index.js` or `App.js`) to polyfill the API.
Run `npm install react-native-uuid` or `yarn add react-native-uuid`. If using React Native, ensure your caches are clear (`npx react-native start --reset-cache`) and rebuild your project (`npx react-native run-ios` / `npx react-native run-android`).
No dependency data recorded yet.