-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForgetScreen.js
193 lines (137 loc) · 5.51 KB
/
ForgetScreen.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
import {
SafeAreaView,
Platform,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
Alert,
TouchableOpacity,
TextInput,
Image,
ImageBackground,
Linking,
FlatList,
Dimensions,
AsyncStorage,
ActivityIndicator,
} from 'react-native';
import React, {Component} from 'react';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import Button from 'react-native-button';
import { SafeAreaProvider } from 'react-native-safe-area-context';
const GLOBAL = require('./Global');
class ForgetScreen extends React.Component {
constructor() {
super();
this.state={
mobile:'',
loading:'',
}
}
showLoading() {
this.setState({loading: true})
}
hideLoading() {
this.setState({loading: false})
}
getRemoteData = () => {
GLOBAL.mobile2 = this.state.mobile
// alert(GLOBAL.mobile2)
if (this.state.mobile == '') {
alert('Please Enter Mobile No.')
}
else {
this.showLoading()
fetch('http://pumpfit.in/admin/webservices/forgot_otp', {
method: 'POST',
headers: {
'x-api-key': 'c3a3cf7c211b7c07b2495d8aef9761fc',
'Content-Type': 'application/json'
},
body: JSON.stringify({
mobile: GLOBAL.mobile2,
}),
}).then((response) => response.json())
.then((responseJson) => {
// alert(JSON.stringify(responseJson))
this.hideLoading()
if (responseJson.status == true) {
// this.setState({result: responseJson.user_detail })
GLOBAL.otp2 = responseJson.otp
GLOBAL.userID2 = responseJson.user_id
// AsyncStorage.setItem('userID', responseJson.user_id);
// // AsyncStorage.setItem('image', this.state.results.image);
// // AsyncStorage.setItem('name', this.state.results.name);
// // AsyncStorage.setItem('email', this.state.results.email);
// // AsyncStorage.setItem('mobile', this.state.results.mobile);
alert('otp has been sent to your registerd profile')
this.props.navigation.navigate('Otp2Screen')
}
else{
alert('Not a Registered Mobile no.!')
}
})
.catch((error) => {
console.error(error);
});
}
}
render() {
if(this.state.loading){
return(
<View style={{flex: 1}}>
<ActivityIndicator style = {{position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
backgroundColor: 'white',
justifyContent: 'center',
alignItems: 'center'}}
size="large" color="#e41582" />
</View>
)
}
return(
<SafeAreaProvider>
<View style={{flex:1,backgroundColor:'white'}}>
<ImageBackground style={{resizeMode:'contain',height:'100%',width:'100%'}} source={require('./login.png')}>
<KeyboardAwareScrollView>
<TouchableOpacity style={{alignSelf:'flex-end',marginTop:'15%',marginRight:'5%'}}
onPress={()=> this.props.navigation.goBack()}>
<Image style={{height:17,width:17}}
source={require('./close.png')}/>
</TouchableOpacity>
<View style={{flexDirection:'column',alignItems:'center',alignSelf:'center',marginTop:'34%',width:'90%'}}>
<Text style={{fontSize:42,fontFamily:'Exo2-Medium',color:'white',width:'100%',textAlign:'center'}}>Forget</Text>
<Text style={{fontSize:42,fontFamily:'Exo2-Medium',color:'white',width:'100%',textAlign:'center',marginTop:-10}}>Password?</Text>
</View>
<Text style={{fontSize:14,fontFamily:'Exo2-Medium',color:'rgba(255, 255, 255, 0.6)',marginTop:'5%',alignSelf:'center'}}>Don't Worry Just Enter Your Mobile No, And We</Text>
<Text style={{fontSize:14,fontFamily:'Exo2-Medium',color:'rgba(255, 255, 255, 0.6)',alignSelf:'center'}}>Will Send an OTP to Your Registered No.</Text>
<View style={{backgroundColor: 'rgba(0,0,0,0.4)',marginLeft:'5%',width:'90%',height:46,borderRadius:10,marginTop:25}}>
<TextInput
style={{fontSize:17,fontFamily:'Exo2-Medium',color:'rgba(255, 255, 255, 0.6)',width:'80%',height:46,marginLeft:'3%'}}
placeholder="Mobile No."
keyboardType="numeric"
maxLength={10}
placeholderTextColor="rgba(255, 255, 255, 0.6)"
onChangeText={(text) => this.setState({mobile: text})}
value={this.state.mobile}
/>
</View>
<Button
style={{fontSize: 18, color: '#161718',fontFamily:'Exo2-SemiBold'}}
containerStyle={{height:50,width:'90%',alignSelf:'center',marginTop:24,borderRadius:10,backgroundColor:'white',justifyContent:'center'}}
onPress={()=>this.getRemoteData()}>
SUBMIT
</Button>
</KeyboardAwareScrollView>
</ImageBackground>
</View>
</SafeAreaProvider>
);
}
}
export default ForgetScreen;