forked from SystangoTechnologies/react-native-apple-sign-in
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (20 loc) · 785 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from 'react';
import { NativeModules ,requireNativeComponent ,Platform } from 'react-native';
const { AppleSignIn } = NativeModules;
export const RNSignInWithAppleButton = requireNativeComponent('RNCSignInWithAppleButton');
export const SignInWithAppleButton = (buttonStyle, callBack) => {
if(Platform.OS === 'ios'){
return <RNSignInWithAppleButton style={buttonStyle} onPress={async () => {
await AppleSignIn.requestAsync({
requestedScopes: [AppleSignIn.Scope.FULL_NAME, AppleSignIn.Scope.EMAIL],
}).then((response) => {
callBack(response) //Display response
}, (error) => {
callBack(error) //Display error
});
}} />
}else{
return null
}
}
export default AppleSignIn;