@kazion/react-native-apple-auth
v0.1.0
Published
A React Native Nitro module for in-app browser
Downloads
58
Readme
react-native-apple-auth
A Simple React Native Nitro module for in-app browser.
[!WARNING]
This library is still under development. Use at your own risk.
Prerequisites
- React Native 0.76 or higher
- Nitro Modules
bun install @kazion/react-native-apple-auth react-native-nitro-modules
cd ios && pod install && cd ..
Feature
[x] Supports iOS [x] Supports Android [x] Supports Web Support
Usage
import { useState } from 'react'
import { Button, SafeAreaView, Text } from 'react-native'
import {
AppleAuthCredential,
AppleAuthOperation,
AppleAuthScopes,
RNAppleAuth,
} from 'react-native-apple-auth'
const App = () => {
const [loading, setLoading] = useState(false)
const [creds, setCreds] = (useState < AppleAuthCredential) | (null > null)
const handleAppleSignin = async () => {
setLoading(true)
try {
const appleAuthCredential = await RNAppleAuth.signIn({
operation: AppleAuthOperation.LOGIN,
scopes: [AppleAuthScopes.EMAIL, AppleAuthScopes.FULL_NAME],
})
setCreds(appleAuthCredential)
} catch (error) {
console.log(JSON.stringify(error))
} finally {
setLoading(false)
}
}
return (
<SafeAreaView style={{ flex: 1 }}>
<Text>Apple AUth With Nitro Modules</Text>
<Text>Email: {creds?.email ?? 'No Email'}</Text>
<Text>Full Name: {creds?.fullName ?? 'No Full Name'}</Text>
<Button
title={loading ? 'Loading...' : 'Sign in with Apple'}
onPress={handleAppleSignin}
/>
</SafeAreaView>
)
}
export default App
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with ❤️ by Patrick Kabwe.
Credits
This package is based on the react-native-nitro-modules package.