wip
This commit is contained in:
34
screens/AuthScreen.tsx
Normal file
34
screens/AuthScreen.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import * as React from 'react';
|
||||
import * as WebBrowser from 'expo-web-browser';
|
||||
import * as Google from 'expo-auth-session/providers/google';
|
||||
import { Button } from 'react-native';
|
||||
import {createContext, useState} from "react";
|
||||
|
||||
WebBrowser.maybeCompleteAuthSession();
|
||||
|
||||
export default function AuthScreen({authCallback} ) {
|
||||
const [request, response, promptAsync] = Google.useAuthRequest({
|
||||
expoClientId: '61386079886-2k3g6793pgt5pha4rhdojpvgrkuccfj7.apps.googleusercontent.com',
|
||||
iosClientId: '61386079886-2k3g6793pgt5pha4rhdojpvgrkuccfj7.apps.googleusercontent.com',
|
||||
androidClientId: '61386079886-2k3g6793pgt5pha4rhdojpvgrkuccfj7.apps.googleusercontent.com',
|
||||
webClientId: '61386079886-2k3g6793pgt5pha4rhdojpvgrkuccfj7.apps.googleusercontent.com',
|
||||
});
|
||||
const AuthContext = useState()
|
||||
React.useEffect(() => {
|
||||
if (response?.type === 'success') {
|
||||
const { authentication } = response;
|
||||
// @ts-ignore
|
||||
authCallback(authentication)
|
||||
}
|
||||
}, [response]);
|
||||
|
||||
return (
|
||||
<Button
|
||||
disabled={!request}
|
||||
title="Login"
|
||||
onPress={() => {
|
||||
promptAsync();
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user