diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-10-16 17:59:39 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-10-16 17:59:39 +0530 |
commit | 450235655c52795f9d4ff78c7dd63018a857961f (patch) | |
tree | 27e918d35eb30559d06f5ed796315092a49c2d04 /src | |
parent | 75787c04b08ab09da90f62689d61b024083da16f (diff) | |
download | mall-app-450235655c52795f9d4ff78c7dd63018a857961f.tar.gz mall-app-450235655c52795f9d4ff78c7dd63018a857961f.tar.bz2 mall-app-450235655c52795f9d4ff78c7dd63018a857961f.zip |
Add the register/signup with forget password options
Diffstat (limited to 'src')
-rw-r--r-- | src/screens/Auth/LoginScreen.js | 90 |
1 files changed, 61 insertions, 29 deletions
diff --git a/src/screens/Auth/LoginScreen.js b/src/screens/Auth/LoginScreen.js index 6b11a5b..f7ef695 100644 --- a/src/screens/Auth/LoginScreen.js +++ b/src/screens/Auth/LoginScreen.js @@ -1,45 +1,77 @@ import React, { useState } from 'react'; -import { View, TextInput, Button, Text } from 'react-native'; -import { login, verifyOtp } from '../../services/authService'; +import { View, Text, TextInput, Button, StyleSheet, Alert } from 'react-native'; const LoginScreen = ({ navigation }) => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); - const [otp, setOtp] = useState(''); - const [isOtpSent, setIsOtpSent] = useState(false); - - const handleLogin = async () => { - try { - const response = await login(email, password); - if (response.data.otpSent) setIsOtpSent(true); - } catch (error) { - console.error('Login error:', error); - } + + const handleLogin = () => { + // Handle login logic here + Alert.alert("Login", "Login button pressed"); + }; + + const handleRegister = () => { + // Navigate to the Signup screen + navigation.navigate('Signup'); }; - const verifyOtp = async () => { - try { - const response = await verifyOtp(email, otp); - if (response.data.success) navigation.navigate('MallSelection'); - } catch (error) { - console.error('OTP verification error:', error); - } + const handleForgotPassword = () => { + // Navigate to the forgot password screen + navigation.navigate('ForgotPassword'); }; return ( - <View> - <TextInput placeholder="Email" value={email} onChangeText={setEmail} /> - <TextInput placeholder="Password" value={password} onChangeText={setPassword} secureTextEntry /> + <View style={styles.container}> + <Text style={styles.title}>Login</Text> + <TextInput + style={styles.input} + placeholder="Email" + value={email} + onChangeText={setEmail} + keyboardType="email-address" + autoCapitalize="none" + /> + <TextInput + style={styles.input} + placeholder="Password" + value={password} + onChangeText={setPassword} + secureTextEntry + /> <Button title="Login" onPress={handleLogin} /> - - {isOtpSent && ( - <View> - <TextInput placeholder="Enter OTP" value={otp} onChangeText={setOtp} /> - <Button title="Verify OTP" onPress={verifyOtp} /> - </View> - )} + <View style={styles.buttonContainer}> + <Button title="Register" onPress={handleRegister} /> + <Button title="Forgot Password?" onPress={handleForgotPassword} /> + </View> </View> ); }; +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'center', + padding: 16, + }, + title: { + fontSize: 24, + fontWeight: 'bold', + marginBottom: 24, + textAlign: 'center', + }, + input: { + height: 40, + borderColor: '#ccc', + borderWidth: 1, + marginBottom: 12, + paddingHorizontal: 8, + }, + buttonContainer: { + marginTop: 12, + flexDirection: 'row', + justifyContent: 'space-between', + }, +}); + export default LoginScreen; + |