Installation

To install the Useawards Expo SDK, you can use npm or yarn. In your project directory, run one of the following commands:

npm install @useawards/useaward-expo

Usage

A token cache is required to work with Useaward and Expo. This is entirely up to you how you handle the token cache - in this example we’re going to use the expo-secure-store library. First, install it by running

npm i expo-secure-store

To use the Useawards SDK in your application, you need to import the desired package(s) and configure them with your API and APP key:

import { UseawardProvider } from "@useawards/useaward-expo";
import * as SecureStore from "expo-secure-store";

const cache = {
  getUserUuid(key) {
    try {
      return SecureStore.getItemAsync(key);
    }
    catch (err) {
      return null;
    }
  },
  saveUserUuid(key, value) {
    try {
      return SecureStore.setItemAsync(key, value);
    }
    catch (err) {
      return null;
    }
  },
};

function App() {
  return (
    <UseawardProvider
        publishableKey=''
        appId=''
        cache={cache}>
      {/* Your app code here */}
    </UseawardsProvider>
  );
}