Skip to content

unveiler-io/react-native-client

Repository files navigation

@unveiler.io/react-native-client

Language grade: JavaScript

A simple, developer friendly library to verify your user's location using the Unveiler verified location API.

Installation

Using NPM:

npm install @unveiler.io/react-native-client

Or Yarn:

yarn add @unveiler.io/react-native-client

Usage

import { UnveilerClient, useLazyVerifiedLocation } from '@unveiler.io/react-native-client'
import { Text, Button } from 'react-native'

const client = new UnveilerClient({ apiKey: 'YOUR_API_KEY' })

const MyModule = () => {
  const { claim, jwt, submit } = useLazyVerifiedLocation({ client })

  return (
    <>
      {submit && <Button onPress={submit} title={'Submit'} />}
      {claim && (
        <Text>
          {claim.location.latitude}, {claim.location.longitude}
        </Text>
      )}
    </>
  )
}

API documentation can be found here.

Example

See an example on how to use this module in examples.

To run it, first create a .env file in the example folder where you add your Unveiler API Key. You can get a key at https://dashboard.unveiler.io.

# Copy the template
cp example/.env.template example/.env

# Open the .env file using your favorite editor
vim example/.env

Then you can start the example app by running:

yarn example android

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT