diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-10-16 18:35:51 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-10-16 18:35:51 +0530 |
commit | 121caf3f3be5dcdd9b5b6f32a9785b3992ef53d5 (patch) | |
tree | 63be675651d51cc5ceb0604e90383f1bd8bed79a /src/screens/Auth/SignupScreen.js | |
parent | fd6e2805940bc6716d08e2190e66239914839f1a (diff) | |
download | mall-app-121caf3f3be5dcdd9b5b6f32a9785b3992ef53d5.tar.gz mall-app-121caf3f3be5dcdd9b5b6f32a9785b3992ef53d5.tar.bz2 mall-app-121caf3f3be5dcdd9b5b6f32a9785b3992ef53d5.zip |
Diffstat (limited to 'src/screens/Auth/SignupScreen.js')
-rw-r--r-- | src/screens/Auth/SignupScreen.js | 57 |
1 files changed, 49 insertions, 8 deletions
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; + |