diff options
-rw-r--r-- | src/screens/Auth/ForgotPasswordScreen.js | 9 | ||||
-rw-r--r-- | src/screens/Auth/SignupScreen.js | 57 |
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; + |