1
+ import React , { useState } from 'react' ;
2
+ import { SafeAreaView , View , TextInput , Button , Alert , TouchableOpacity , Text } from 'react-native' ;
3
+ import { useNavigation } from '@react-navigation/native' ;
4
+ import Icon from 'react-native-vector-icons/MaterialIcons' ;
5
+
6
+ import * as Component from '../../Components/Components' ;
7
+ import * as SignUpComponent from '../../Components/SignUpComponents' ;
8
+ import AuthViewModel from '../../UserAuthentication/AuthViewModel' ;
9
+ import { isValidPassword } from '../../Utils/DataVerify' ;
10
+
11
+ import Styles from '../../Styles/Styles' ;
12
+ import SignUpStyle from '../../Styles/SignUpStyle' ;
13
+
14
+ const PasswordView = ( ) =>
15
+ {
16
+ const navigation = useNavigation ( ) ;
17
+ const [ password , setPassword ] = useState ( '' ) ;
18
+
19
+ const backArrow = ( ) => {
20
+ navigation . navigate ( 'UsernameView' ) ;
21
+ } ;
22
+
23
+ // Checks that password is valid if not shows user why not
24
+ const nextButton = ( ) =>
25
+ {
26
+ let isPasswordValid = isValidPassword ( password )
27
+ if ( isPasswordValid . isValid )
28
+ {
29
+ //navigation.navigate('AgeView')
30
+ }
31
+ else
32
+ {
33
+ Alert . alert ( `${ isPasswordValid . reason } ` ) ;
34
+ }
35
+ } ;
36
+
37
+ return (
38
+ < Component . PrimaryBackground >
39
+ < SafeAreaView style = { Styles . safeZone } >
40
+ < View style = { SignUpStyle . container } >
41
+ < TouchableOpacity onPress = { backArrow } >
42
+ < Icon name = "arrow-back-ios" color = "#FFF" style = { SignUpStyle . backArrow } />
43
+ </ TouchableOpacity >
44
+ < SignUpComponent . SignUpInput
45
+ heading = "Good Password?"
46
+ subheading = { "Try and pick something secure...\nyour data matters." }
47
+ placeholder = "Password"
48
+ value = { password }
49
+ onChangeText = { setPassword }
50
+ style = { {
51
+ container : SignUpStyle . input ,
52
+ heading : SignUpStyle . heading ,
53
+ subheading : SignUpStyle . subheading ,
54
+ } }
55
+ />
56
+ < TouchableOpacity onPress = { nextButton } style = { SignUpStyle . nextButton } >
57
+ < Text style = { SignUpStyle . nextButtonText } > Next</ Text >
58
+ </ TouchableOpacity >
59
+ </ View >
60
+ </ SafeAreaView >
61
+ </ Component . PrimaryBackground >
62
+ ) ;
63
+ } ;
64
+
65
+ export default PasswordView ;
0 commit comments