Reputation: 107
I want to generate a uuid in ReactNative app built with expo cli.. when I install UUIDGenerator
from React-native-uuid-generator
, I get undefined is not an object(evaluating ‘RNUUIDGenerator.getRandomUUID’..)
Tried two dif libraries, react-native-uuid
, and React-native-uuid-generator
, same problem, think it might have to do with expo not liking the link command.
UUIDGenerator.getRandomUUID().then(uuid => console.log(uuid));
Expecting new uuid to be printed, actually getting error message.
Upvotes: 2
Views: 6168
Reputation: 16132
react-native-uuid
works with expo.
npm install react-native-uuid --save
import uuid from 'react-native-uuid';
then generatte uuid like
const uuid = uuid.v1();
Upvotes: 8