diff options
Diffstat (limited to 'app/(auth)/signup.tsx')
| -rw-r--r-- | app/(auth)/signup.tsx | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/app/(auth)/signup.tsx b/app/(auth)/signup.tsx index 127ea9f..eded0b6 100644 --- a/app/(auth)/signup.tsx +++ b/app/(auth)/signup.tsx @@ -2,22 +2,28 @@ import { Ionicons } from "@expo/vector-icons"; import { router } from "expo-router"; import { useState } from "react"; import { - KeyboardAvoidingView, - Platform, - ScrollView, - StyleSheet, - Text, - TouchableOpacity, - View, + KeyboardAvoidingView, + Platform, + ScrollView, + StyleSheet, + Text, + TouchableOpacity, + View, } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; import { useAuth } from "../../lib/auth"; +import { useGoogleAuth } from "../../lib/google-auth"; import { t } from "../../lib/locales"; import { colors } from "../../lib/theme"; import { Button, H1, Muted, TextInput } from "../../lib/ui"; export default function SignUp() { const { signUp } = useAuth(); + const { + continueWithGoogle, + isLoading: googleLoading, + error: googleError, + } = useGoogleAuth(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [confirmPassword, setConfirmPassword] = useState(""); @@ -66,7 +72,7 @@ export default function SignUp() { if (!result.success) { setError(result.reason || t("signUpError")); } - } catch (e) { + } catch { setError(t("signUpError")); } finally { setLoading(false); @@ -129,8 +135,23 @@ export default function SignUp() { title={t("signUp")} onPress={handleSignUp} loading={loading} - disabled={loading} + disabled={loading || googleLoading} /> + + <Button + title={t("continueWithGoogle")} + variant="secondary" + onPress={continueWithGoogle} + loading={googleLoading} + disabled={loading || googleLoading} + /> + <Muted style={styles.googleHelp}> + {t("googleAuthUnifiedHint")} + </Muted> + + {googleError ? ( + <Text style={styles.error}>{googleError}</Text> + ) : null} </View> <View style={styles.footer}> @@ -171,6 +192,10 @@ const styles = StyleSheet.create({ fontSize: 14, textAlign: "center", }, + googleHelp: { + textAlign: "center", + paddingHorizontal: 8, + }, footer: { flexDirection: "row", justifyContent: "center", |