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();
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { Platform, StyleSheet } from 'react-native';
|
||||
|
||||
import EditScreenInfo from '../components/EditScreenInfo';
|
||||
import { Text, View } from '../components/Themed';
|
||||
|
||||
export default function ModalScreen() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>Modal</Text>
|
||||
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
|
||||
<EditScreenInfo path="/screens/ModalScreen.tsx" />
|
||||
|
||||
{/* Use a light status bar on iOS to account for the black space above the modal */}
|
||||
<StatusBar style={Platform.OS === 'ios' ? 'light' : 'auto'} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
title: {
|
||||
fontSize: 20,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
separator: {
|
||||
marginVertical: 30,
|
||||
height: 1,
|
||||
width: '80%',
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user