Skip to content

nvdnvd00/react-native-login-amazon

Repository files navigation

react-native-login-amz

Installation

$ npm install react-native-login-amz --save

or

$ yarn add react-native-login-amz

(RN <0.59)$ react-native link react-native-login-amz

Add your api key

IOS

Android

  • Create api_key.txt in android/app/src/main/assets and put you Amazon api key here (Instruction ).

Usage

import { useEffect } from "react";
import { Text, TouchableOpacity } from "react-native";
import LoginAmz from "react-native-login-amz";
const LoginAmzEventEmitter = new NativeEventEmitter(LoginAmz);

const Screen = () => {
  useEffect(() => {
    const handler = LoginAmzEventEmitter.addListener("LOGINAMZ", data => {
      console.log("AMZ LOGIN", data);
      if (data.status === "Ok") {
        //
      }
      if (data.status === "Error") {
        //
      }
      if (data.status === "Cancel") {
        //
      }
    });
    return () => {
      handler.remove();
    };
  }, []);
  return (
    <TouchableOpacity onPress={() => LoginAmz.loginAMZ()}>
      <Text>Login</Text>
    </TouchableOpacity>
  );
};

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages