0.2.0 • Published 2 years ago
helixpay-react-native v0.2.0
# HelixPay React Native Library
HelixPay is a React Native library that provides easy integration with the HelixPay SDK.
## Important Dependencies
- **react-native-device-info:** v10.12.0
- Description: A library to retrieve device information in React Native.
- [Link to react-native-device-info](https://github.com/react-native-device-info/react-native-device-info)
- **react-native-keychain:** v8.1.2
- Description: Secure keychain storage for React Native applications.
- [Link to react-native-keychain](https://github.com/oblador/react-native-keychain)
## Installation
Install the library in your React Native project using npm or yarn:
```bash
npm install helixpay-react-native react-native-device-info react-native-keychain
```
or
yarn add helixpay-react-native
Usage
HelixPayProvider
Wrap your application with the HelixPayProvider
to initialize the HelixPay context.
import { HelixPayProvider } from 'helixpay-react-native';
function App() {
return (
<HelixPayProvider sdkId="YourSdkId">
{/* Your app components here */}
</HelixPayProvider>
);
}
useHelixPay Hook
Use the useHelixPay
hook to access HelixPay functionalities within your components.
import { useHelixPay } from 'helixpay-react-native';
function Login() {
const { login } = useHelixPay();
return (
<View style={styles.container}>
<Text>Result: </Text>
{user ? (
<View>
<Text>{user.displayName}</Text>
<Button
title="Logout"
onPress={async () => {
await logout();
}}
/>
</View>
) : (
<Button
title="Login"
onPress={async () => {
const userResponse = await login({
login: 'jake@ittm.io',
password: 'Testing2!',
});
console.log('userResponse', userResponse);
}}
/>
)}
</View>
);
}
Props
HelixPayProvider
- sdkId (required): Your HelixPay SDK ID.
License
This library is licensed under the MIT License - see the LICENSE file for details.
0.2.0
2 years ago