acupedia-mobile-ui/src/screens/auth/LoginScreen.tsx

90 lines
2.1 KiB
TypeScript

import React, { useState } from "react";
import {
KeyboardAvoidingView,
Platform,
ScrollView,
StyleSheet,
View,
} from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import {
moderateScale,
verticalScale,
} from "react-native-size-matters";
import { router } from "expo-router";
import { Colors } from "@/theme";
import LoginHeader from "@/features/auth/components/LoginHeader";
import LoginTabs, {
LoginMethod,
} from "@/features/auth/components/LoginTabs";
import LoginForm from "@/features/auth/components/LoginForm";
import SocialLogin from "@/features/auth/components/SocialLogin";
import LoginFooter from "@/features/auth/components/LoginFooter";
export default function LoginScreen() {
const [activeTab, setActiveTab] =
useState<LoginMethod>("email");
return (
<SafeAreaView style={styles.safeArea}>
<KeyboardAvoidingView
style={styles.keyboardContainer}
behavior={Platform.OS === "ios" ? "padding" : undefined}
>
<ScrollView
contentContainerStyle={styles.contentContainer}
keyboardShouldPersistTaps="handled"
keyboardDismissMode="on-drag"
automaticallyAdjustKeyboardInsets={true}
showsVerticalScrollIndicator={false}
>
<View style={styles.container}>
<LoginHeader />
<LoginTabs
activeTab={activeTab}
onTabChange={setActiveTab}
/>
<LoginForm
activeTab={activeTab}
/>
<SocialLogin />
<LoginFooter
onSignUpPress={() => {
router.push("/register");
}}
/>
</View>
</ScrollView>
</KeyboardAvoidingView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
safeArea: {
flex: 1,
backgroundColor: Colors.background,
},
keyboardContainer: {
flex: 1,
},
contentContainer: {
flexGrow: 1,
},
container: {
flex: 1,
paddingHorizontal: moderateScale(24),
paddingTop: verticalScale(20),
paddingBottom: verticalScale(32),
backgroundColor: Colors.background,
},
});