Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add information on usage from React Native #385

Merged
merged 1 commit into from Feb 27, 2020

Conversation

LinusU
Copy link
Member

@LinusU LinusU commented Feb 26, 2020

Closes #375

This adds information on how to get the library working on React Native to the readme.


I've verified that this works by:

  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)

@LinusU
Copy link
Member Author

LinusU commented Feb 26, 2020

ping @ctavan, this PR is per my comments in #375 ☺️

@ctavan ctavan merged commit 719e1b4 into uuidjs:master Feb 27, 2020
@LinusU LinusU deleted the react-native branch February 27, 2020 12:25
@SimenB
Copy link
Contributor

SimenB commented Feb 27, 2020

Does this work in Expo? If not (seems like it's a native lib), a separate section for expo would be ❤️

@geraintwhite
Copy link

After including that polyfill the errors change to the following on both iOS and Android:

'Unhandled promise rejection', { [TypeError: null is not an object (evaluating 'RNGetRandomValues.getRandomBase64')]

@LinusU
Copy link
Member Author

LinusU commented Feb 27, 2020

@SimenB ah right, no it won't. Expo currently doesn't have a sync random api, opening upstream issue now

@grit96 is that on Expo?

@geraintwhite
Copy link

@LinusU nope, RN 0.59. I just realised that react-native-get-random-values probably needs linking because I'm using RN < 0.60.

@LinusU
Copy link
Member Author

LinusU commented Feb 27, 2020

probably needs linking because I'm using RN < 0.60

Yeah, that's probably it.

Sorry, I removed the linking step from the readme since I thought that most people would be on >= 0.60 by now ☺️

@LinusU
Copy link
Member Author

LinusU commented Feb 27, 2020

Issue filed with Expo here: expo/expo#7209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Version >=7.0.0 is not compatible with React Native / Expo
4 participants