-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOTPScreen.js
160 lines (155 loc) · 3.71 KB
/
OTPScreen.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
import React, { useState, Component } from 'react';
import {
StyleSheet,
View,
Image,
ScrollView,
Text,
TextInput,
TouchableOpacity,
Alert,
} from 'react-native';
import AppLogo from '../components/AppLogo';
const OTP = '123456';
function OTPScreen({ navigation }) {
const [otp, setOtp] = useState('');
const onSubmitHandler = () => {
if (otp) {
if (otp.length < 6) {
Alert.alert('OTP length incorrect', 'Please input a 6 digit OTP');
} else {
if (otp === OTP) {
navigation.navigate('Tabs');
} else {
Alert.alert('Incorrect OTP', 'Please input a valid OTP');
}
}
} else {
Alert.alert('Missing Input', 'Please input a 6 digit OTP');
}
};
return (
<ScrollView contentContainerStyle={styles.container}>
<AppLogo />
<View style={styles.scrollArea}>
<Text style={styles.loremIpsum3}>Enter your Temporary Code</Text>
<View style={styles.rect}>
<View style={styles.enterCodeRow}>
<Text style={styles.enterCode}>ENTER CODE :</Text>
<TextInput
placeholder='XXXXXX'
placeholderTextColor='rgba(237,235,235,0.62)'
style={styles.xxxxxx}
maxLength={6}
value={otp}
onChangeText={(input) => setOtp(input)}
keyboardType='numeric'
></TextInput>
</View>
</View>
<TouchableOpacity>
<Text style={styles.resendOtp}>Resend OTP</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.button} onPress={onSubmitHandler}>
<Text style={styles.enter}>Enter</Text>
</TouchableOpacity>
<Text style={styles.loremIpsum2}>
By creating or using an Account you agree to the {'\n'}ParkYourself
Terms & Conditions and Privacy Policy
</Text>
</View>
</ScrollView>
);
}
const styles = StyleSheet.create({
container: {
// flex: 1,
backgroundColor: '#fff',
},
scrollArea: {
width: '100%',
height: 470,
backgroundColor: 'rgba(39,170,225,1)',
marginTop: 49,
alignItems: 'center',
},
loremIpsum3: {
fontFamily: 'roboto-500',
color: 'rgba(246,246,246,1)',
fontSize: 24,
marginTop: 59,
// marginLeft: 41,
},
rect: {
width: 314,
height: 86,
borderWidth: 2,
borderColor: 'rgba(252,252,252,1)',
borderRadius: 7,
flexDirection: 'row',
marginTop: 38,
// marginLeft: 30,
},
enterCode: {
fontFamily: 'roboto-500',
color: 'rgba(237,235,235,1)',
fontSize: 22,
opacity: 0.62,
},
xxxxxx: {
fontFamily: 'roboto-regular',
color: 'rgba(250,248,248,1)',
height: 26,
width: 94,
fontSize: 22,
marginLeft: 13,
},
enterCodeRow: {
height: 26,
flexDirection: 'row',
flex: 1,
marginRight: 31,
marginLeft: 36,
marginTop: 30,
},
resendOtp: {
fontFamily: 'roboto-regular',
color: 'rgba(231,229,229,1)',
textDecorationLine: 'underline',
marginTop: 13,
marginLeft: 230,
// alignSelf: 'flex-end',
},
button: {
width: 314,
height: 56,
backgroundColor: 'rgba(249,249,249,1)',
shadowColor: 'rgba(0,0,0,1)',
shadowOffset: {
width: 10,
height: 10,
},
elevation: 150,
shadowOpacity: 0.33,
shadowRadius: 50,
marginTop: 36,
// marginLeft: 30,
},
enter: {
fontFamily: 'roboto-500',
color: 'rgba(39,170,225,1)',
fontSize: 17,
marginTop: 18,
marginLeft: 138,
},
loremIpsum2: {
fontFamily: 'roboto-regular',
color: 'rgba(245,245,245,1)',
textAlign: 'center',
fontSize: 15,
lineHeight: 22,
marginTop: 34,
// marginLeft: 14,
},
});
export default OTPScreen;