Skip to content

Commit

Permalink
docs: add information on usage from React Native (#385)
Browse files Browse the repository at this point in the history
This adds information on how to get the library working on React Native to the readme.

To verify that this works:

1. creating a new React Native project (`npx react-native init uuidtest`)
2. added the dependencies (`npm add react-native-get-random-values uuid`)
3. imported the polyfill (`import 'react-native-get-random-values'` in `index.js`)
4. and displayed an UUID in the app (`import * as uuid from 'uuid'` and `{uuid.v4()}` in `App.js`)

Closes #375
  • Loading branch information
LinusU authored Feb 27, 2020
1 parent 44f2f86 commit 719e1b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ versions, all of which are supported here. In order of popularity, they are:

**Unsure which one to use?** Use version 4 (random) unless you have a specific need for one of the other versions. See also [this FAQ](https://github.com/tc39/proposal-uuid#faq).

**Are you using React Native?** If you are using this library from React Native, you need to add a polyfill for `crypto.getRandomValues`. We recommend using [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme).

### Create Version 4 (Random) UUIDs

```javascript
Expand Down
2 changes: 2 additions & 0 deletions README_js.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ versions, all of which are supported here. In order of popularity, they are:

**Unsure which one to use?** Use version 4 (random) unless you have a specific need for one of the other versions. See also [this FAQ](https://github.com/tc39/proposal-uuid#faq).

**Are you using React Native?** If you are using this library from React Native, you need to add a polyfill for `crypto.getRandomValues`. We recommend using [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme).

### Create Version 4 (Random) UUIDs

```javascript --run v4
Expand Down

0 comments on commit 719e1b4

Please sign in to comment.