added registration page
This commit is contained in:
@@ -3,8 +3,12 @@ import React, { useState } from 'react';
|
||||
import { View, StyleSheet, KeyboardAvoidingView, Platform } from 'react-native';
|
||||
import { TextInput, Button, Text, useTheme, HelperText, ActivityIndicator, Avatar } from 'react-native-paper';
|
||||
import { useAuth } from '../contexts/AuthContext';
|
||||
import { NativeStackScreenProps } from '@react-navigation/native-stack';
|
||||
import { AuthStackParamList } from '../types/navigation'; // Import from the new types file
|
||||
|
||||
const LoginScreen = () => {
|
||||
type LoginScreenProps = NativeStackScreenProps<AuthStackParamList, 'Login'>;
|
||||
|
||||
const LoginScreen: React.FC<LoginScreenProps> = ({ navigation }) => {
|
||||
const theme = useTheme();
|
||||
const { login } = useAuth();
|
||||
const [username, setUsername] = useState('');
|
||||
@@ -116,6 +120,7 @@ const LoginScreen = () => {
|
||||
{isLoading ? (
|
||||
<ActivityIndicator animating={true} color={theme.colors.primary} style={styles.loadingContainer}/>
|
||||
) : (
|
||||
<>
|
||||
<Button
|
||||
mode="contained"
|
||||
onPress={handleLogin}
|
||||
@@ -125,9 +130,21 @@ const LoginScreen = () => {
|
||||
>
|
||||
Login
|
||||
</Button>
|
||||
|
||||
{/* Add Register Button */}
|
||||
<Button
|
||||
mode="outlined" // Use outlined for secondary action
|
||||
onPress={() => navigation.navigate('Register')} // Navigate to Register screen
|
||||
style={styles.button} // Reuse button style or create a new one
|
||||
disabled={isLoading}
|
||||
icon="account-plus-outline"
|
||||
>
|
||||
Register
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* TODO: Add Register here */}
|
||||
{/* TODO: Add Register here - REMOVED */}
|
||||
</KeyboardAvoidingView>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user