@@ -3,21 +3,33 @@ import { View, Text, TextInput, TouchableOpacity, StyleSheet, Alert, KeyboardAvo
33import { SafeAreaView } from 'react-native-safe-area-context' ;
44import { Ionicons } from '@expo/vector-icons' ;
55import AsyncStorage from '@react-native-async-storage/async-storage' ;
6- import { GoogleSignin , statusCodes } from '@react-native-google-signin/google-signin' ;
76import { colors } from '../theme/colors' ;
87import { useApp } from '../context/AppContext' ;
98
10- GoogleSignin . configure ( {
11- webClientId : '1076957044730-mht8sbihb0d4661hprrvbjf9v4gb0njr.apps.googleusercontent.com' ,
12- offlineAccess : true ,
13- } ) ;
9+ let GoogleSignin , statusCodes ;
10+ try {
11+ const gs = require ( '@react-native-google-signin/google-signin' ) ;
12+ GoogleSignin = gs . GoogleSignin ;
13+ statusCodes = gs . statusCodes ;
14+ GoogleSignin . configure ( {
15+ webClientId : '1076957044730-mht8sbihb0d4661hprrvbjf9v4gb0njr.apps.googleusercontent.com' ,
16+ offlineAccess : true ,
17+ } ) ;
18+ } catch ( e ) {
19+ GoogleSignin = null ;
20+ statusCodes = { } ;
21+ }
1422
1523export default function LoginScreen ( { navigation } ) {
1624 const [ isSignUp , setIsSignUp ] = useState ( false ) ;
1725 const [ form , setForm ] = useState ( { name : '' , email : '' , password : '' , confirm : '' } ) ;
1826 const { login } = useApp ( ) ;
1927
2028 const handleGoogleSignIn = async ( ) => {
29+ if ( ! GoogleSignin ) {
30+ Alert . alert ( 'Not Available' , 'Google Sign In is only available in the production build.' ) ;
31+ return ;
32+ }
2133 try {
2234 await GoogleSignin . hasPlayServices ( ) ;
2335 const userInfo = await GoogleSignin . signIn ( ) ;
0 commit comments