blob: 6e6ac53086d175271307c728f06bfbe52972fb44 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
|