diff --git a/react-native/screens/LoginScreen.tsx b/react-native/screens/LoginScreen.tsx
index 3d1b766..f6e4572 100644
--- a/react-native/screens/LoginScreen.tsx
+++ b/react-native/screens/LoginScreen.tsx
@@ -1,129 +1,136 @@
import React, { useState } from 'react';
-import { StyleSheet, Text, SafeAreaView, View, Alert, Image } from 'react-native';
+import { StyleSheet, Text, View, KeyboardAvoidingView, Alert, Image, Platform } from 'react-native';
import { TextInput, Button } from 'react-native-paper';
import { emailValidator, passwordValidator } from '../core/utils';
import { theme } from '../core/theme';
import type { Navigation } from '../types';
export default function LoginScreen({ navigation }: Navigation) {
- const [email, setEmail] = useState('');
- const [password, setPassword] = useState('');
+ const [email, setEmail] = useState('');
+ const [password, setPassword] = useState('');
- const errorAlert = (error: string) =>
- Alert.alert(
- "Login Failed",
- error,
- [
- { text: "OK", onPress: () => console.log("OK Pressed") }
- ]
- );
+ const errorAlert = (error: string) =>
+ Alert.alert(
+ "Login Failed",
+ error,
+ [
+ { text: "OK", onPress: () => console.log("OK Pressed") }
+ ]
+ );
- const onLoginPressed = () => {
- const emailError = emailValidator(email);
- const passwordError = passwordValidator(password);
+ const onLoginPressed = () => {
+ const emailError = emailValidator(email);
+ const passwordError = passwordValidator(password);
- if (emailError || passwordError) {
- errorAlert(emailError ? emailError : passwordError);
- return;
- }
+ if (emailError || passwordError) {
+ errorAlert(emailError ? emailError : passwordError);
+ return;
+ }
- navigation.navigate('Home');
- };
+ navigation.navigate('Home');
+ };
- return (
-
+ return (
+
+
+
+ Sign in
+
-
-
- Sign in
-
+
+ setEmail(text)}
+ autoCapitalize="none"
+ textContentType="emailAddress"
+ autoComplete="email"
+ keyboardType="email-address"
+ autoFocus
+ />
+ setPassword(text)}
+ autoComplete="password"
+ secureTextEntry
+ />
-
- setEmail(text)}
- autoCapitalize="none"
- textContentType="emailAddress"
- autoComplete="email"
- keyboardType="email-address"
- />
+
- setPassword(text)}
- autoComplete="password"
- secureTextEntry
- />
+
-
-
-
-
-
-
-
-
- )
+
+
+
+ )
};
const styles = StyleSheet.create({
- container: {
- margin: 20,
- backgroundColor: theme.colors.background,
- flex: 1,
- flexDirection: 'column',
- justifyContent: 'space-between'
- },
- loginImage: {
- width: 50,
- height: 50,
- },
- title: {
- paddingTop: 40,
- fontWeight: '700',
- fontSize: 36,
- },
- input: {
- height: 40,
- borderWidth: 1,
- marginVertical: 10,
- borderRadius: 4,
- backgroundColor: '#fff'
- },
- submit: {
- height: 40,
- marginBottom: 10
- },
- forgotPassword: {
- width: '100%',
- alignItems: 'flex-end',
- marginBottom: 24,
- },
+ container: {
+ paddingVertical: 20,
+ margin: 20,
+ backgroundColor: theme.colors.background,
+ flex: 1,
+ flexDirection: 'column',
+ },
+ topView: {
+ flex: 1,
+ alignItems: 'center',
+ justifyContent: 'center'
+ },
+ bottomView: {
+ flex: 1,
+ paddingBottom: 40
+ },
+ loginImage: {
+ width: 50,
+ height: 50,
+ },
+ title: {
+ paddingTop: 30,
+ fontWeight: '700',
+ fontSize: 36,
+ },
+ input: {
+ height: 40,
+ borderWidth: 1,
+ marginVertical: 10,
+ borderRadius: 4,
+ backgroundColor: '#fff'
+ },
+ submit: {
+ height: 40,
+ marginBottom: 10
+ },
+ forgotPassword: {
+ width: '100%',
+ alignItems: 'flex-end',
+ marginBottom: 24,
+ },
});
\ No newline at end of file