-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForgotpass.js
122 lines (113 loc) · 2.55 KB
/
Forgotpass.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import { StatusBar } from 'expo-status-bar';
import React, { Component } from 'react';
import Constants from 'expo-constants';
import {
View,
Text,
TouchableOpacity,
TextInput,
StyleSheet,
Image,
Alert
} from 'react-native';
import fire_base from './firebase/firebase';
class Forgotpass extends Component {
constructor(props) {
super(props);
this.state = {
email:null
};
const { navigation } = this.props;
this.navigation = navigation;
}
onSendEmail=async()=>{
await fire_base.resetUser(this.state.email,this.sendEmailSuccess,this.unsuccess);
}
sendEmailSuccess=()=>{
Alert.alert(
"Success!!!",
"Please Check Your Email And Reset Password",
[
{ text: "OK", onPress: () => this.navigation.navigate('Login') }
],
{ cancelable: false }
);
}
unsuccess=(error)=>{
Alert.alert(
"Error!!!",
error.message,
[
{ text: "OK", onPress: () => console.log("OK Pressed") }
],
{ cancelable: false }
);
}
render(props) {
return (
<View style={styles.container}>
<View style={styles.top}>
<Image source={require('./logo2.png')} style={styles.logo} />
</View>
<View style={styles.bottom}>
<TextInput
style={styles.textInput}
placeholder="Email"
keyboardType='email-address'
onChangeText={(text)=>this.setState({email:text})}
/>
<TouchableOpacity style={styles.botton} onPress={this.onSendEmail}>
<Text style={{ color: 'white', fontWeight: 'bold' }}>Recovery</Text>
</TouchableOpacity>
</View>
<StatusBar style="light" />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
},
top: {
flex: 1,
backgroundColor: '#6E7D75',
justifyContent: 'center',
alignItems: 'center',
},
bottom: {
flex: 2,
flexDirection: 'column',
justifyContent: 'center',
padding: 30,
backgroundColor: 'white',
},
logo: {
resizeMode: 'contain',
height: 100,
width: 100,
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 2,
},
},
textInput: {
borderWidth: 1,
height: 40,
borderRadius: 7,
borderColor: 'gray',
paddingStart: 10,
marginBottom: 10,
},
botton: {
height: 40,
borderRadius: 7,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#EBA966',
marginBottom: 15,
},
});
export default Forgotpass;