react-native-uuids

1.0.7 • Public • Published

React Native UUID

react-native-uuids is a simple library to create Native RFC-4122 V4 UUIDs. The package is both Android and iOS compatible.

Getting started

yarn add react-native-uuids
# or with npm 
npm install react-native-uuids

Mostly automatic installation

For React-Native >= 0.60 this module will be linked automatically.

cd ios && pod install

Before 0.60 react-native-uuids can be manually linked.

react-native link react-native-uuids

Usage

import React, {useState} from 'react';
import {Text} from 'react-native';
import UUID from 'react-native-uuids';
 
const Home: () => React$Node = () => {
  const [uuid, setUuid] = useState(null);
 
  if (!uuid) {
    UUID.create((error, createdUuid) => {
      if (error) {
        console.error(error);
      } else {
        setUuid(createdUuid);
      }
    });
  }
  return <Text>{uuid}</Text>;
};
 
export default Home;

Dependencies (1)

Dev Dependencies (2)

Package Sidebar

Install

npm i react-native-uuids

Weekly Downloads

5

Version

1.0.7

License

MIT

Unpacked Size

895 kB

Total Files

71

Last publish

Collaborators

  • sebastian-ruehmann