0.0.1 • Published 2 years ago

oneid-react-native v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

The React Native SDK for OneID Tech

NPM

For more information on OneID and its features, see the documentation.

📲 Installation

install the package via npm:

npm install oneid-react-native --save

or yarn:

yarn add oneid-react-native

then link the package (for react-native < 0.60):

react-native link oneid-react-native

💻 Usage:

To use the SDK, you need to import it first:

import { OneidProvider } from "oneid-react-native";

const App = () => {
  return (
    <OneidProvider apiKey="YOUR_API_KEY">
      <YourApp />
    </OneidProvider>
  );
};

Then you can use the hook to login user in

import { useOneid } from "oneid-react-native";

const YourApp = () => {
  const { login } = useOneid();

  const handleLogin = async () => {
    try {
      const user = await login();
      console.log(user);
    } catch (error) {
      console.log(error);
    }
  };

  return (
    <View>
      <Button title="Login" onPress={handleLogin} />
    </View>
  );
};