aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-10-16 18:35:51 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-10-16 18:35:51 +0530
commit121caf3f3be5dcdd9b5b6f32a9785b3992ef53d5 (patch)
tree63be675651d51cc5ceb0604e90383f1bd8bed79a /src
parentfd6e2805940bc6716d08e2190e66239914839f1a (diff)
downloadmall-app-121caf3f3be5dcdd9b5b6f32a9785b3992ef53d5.tar.gz
mall-app-121caf3f3be5dcdd9b5b6f32a9785b3992ef53d5.tar.bz2
mall-app-121caf3f3be5dcdd9b5b6f32a9785b3992ef53d5.zip
Added more navigation in SignUpScreen and in ForgotPasswordScreen
Diffstat (limited to 'src')
-rw-r--r--src/screens/Auth/ForgotPasswordScreen.js9
-rw-r--r--src/screens/Auth/SignupScreen.js57
2 files changed, 57 insertions, 9 deletions
diff --git a/src/screens/Auth/ForgotPasswordScreen.js b/src/screens/Auth/ForgotPasswordScreen.js
index a768f20..0dd8c08 100644
--- a/src/screens/Auth/ForgotPasswordScreen.js
+++ b/src/screens/Auth/ForgotPasswordScreen.js
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { View, Text, TextInput, Button, StyleSheet, Alert } from 'react-native';
-const ForgotPasswordScreen = () => {
+const ForgotPasswordScreen = ({ navigation }) => {
const [email, setEmail] = useState('');
const handleForgotPassword = () => {
@@ -21,6 +21,9 @@ const ForgotPasswordScreen = () => {
autoCapitalize="none"
/>
<Button title="Reset Password" onPress={handleForgotPassword} />
+ <View style={styles.buttonContainer}>
+ <Button title="Back to Login" onPress={() => navigation.navigate('Login')} />
+ </View>
</View>
);
};
@@ -44,6 +47,10 @@ const styles = StyleSheet.create({
marginBottom: 12,
paddingHorizontal: 8,
},
+ buttonContainer: {
+ marginTop: 12,
+ },
});
export default ForgotPasswordScreen;
+
diff --git a/src/screens/Auth/SignupScreen.js b/src/screens/Auth/SignupScreen.js
index 6e6ac53..6ba1402 100644
--- a/src/screens/Auth/SignupScreen.js
+++ b/src/screens/Auth/SignupScreen.js
@@ -1,6 +1,5 @@
import React, { useState } from 'react';
-import { View, TextInput, Button, Text } from 'react-native';
-import { resetPassword } from '../../services/authService';
+import { View, TextInput, Button, Text, StyleSheet, Alert } from 'react-native';
import emailService from '../../services/emailService';
const SignupScreen = ({ navigation }) => {
@@ -8,24 +7,66 @@ const SignupScreen = ({ navigation }) => {
const [password, setPassword] = useState('');
const handleSignup = async () => {
- // Implement user creation logic here or call the backend
try {
// Trigger OTP email using custom email service
await emailService.sendOtp(email);
- alert('OTP sent to your email');
- navigation.navigate('Login');
+ Alert.alert('Success', 'OTP sent to your email');
+ navigation.navigate('Login'); // Navigate to Login after sending OTP
} catch (error) {
console.error('Signup error:', error);
+ Alert.alert('Error', 'There was an error sending the OTP. Please try again.');
}
};
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}>Sign Up</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="Sign Up" onPress={handleSignup} />
+ <View style={styles.buttonContainer}>
+ <Button title="Already have an account? Log In" onPress={() => navigation.navigate('Login')} />
+ </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,
+ },
+});
+
export default SignupScreen;
+