diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-10-16 16:18:13 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-10-16 16:18:13 +0530 |
commit | da8bdf358b241304d8f4430bcaea93ada605f904 (patch) | |
tree | 8d2e7e0427aca05636e1b7b16550cc62ffbfe661 /src/screens/Auth | |
parent | 4b17ff286037c6bb55cea7329e3123bf4808c797 (diff) | |
download | mall-app-da8bdf358b241304d8f4430bcaea93ada605f904.tar.gz mall-app-da8bdf358b241304d8f4430bcaea93ada605f904.tar.bz2 mall-app-da8bdf358b241304d8f4430bcaea93ada605f904.zip |
Add SignupScreen with email OTP initiation
Diffstat (limited to 'src/screens/Auth')
-rw-r--r-- | src/screens/Auth/SignupScreen.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/screens/Auth/SignupScreen.js b/src/screens/Auth/SignupScreen.js new file mode 100644 index 0000000..6e6ac53 --- /dev/null +++ b/src/screens/Auth/SignupScreen.js @@ -0,0 +1,31 @@ +import React, { useState } from 'react'; +import { View, TextInput, Button, Text } from 'react-native'; +import { resetPassword } from '../../services/authService'; +import emailService from '../../services/emailService'; + +const SignupScreen = ({ navigation }) => { + const [email, setEmail] = useState(''); + 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'); + } catch (error) { + console.error('Signup error:', error); + } + }; + + return ( + <View> + <TextInput placeholder="Email" value={email} onChangeText={setEmail} /> + <TextInput placeholder="Password" value={password} onChangeText={setPassword} secureTextEntry /> + <Button title="Sign Up" onPress={handleSignup} /> + </View> + ); +}; + +export default SignupScreen; |