1
1
import React , { useState } from "react" ;
2
- import { StyleSheet , TouchableOpacity , Text , View } from "react-native" ;
3
- import { Button , TextInput , useTheme } from "react-native-paper" ;
2
+ import { StyleSheet , TouchableOpacity , View , Pressable } from "react-native" ;
3
+ import {
4
+ Button ,
5
+ Checkbox ,
6
+ Text ,
7
+ List ,
8
+ MD3Colors ,
9
+ TextInput ,
10
+ useTheme ,
11
+ } from "react-native-paper" ;
4
12
import { useNavigation } from "@react-navigation/native" ;
5
13
6
14
import { FormInput } from "../components/FromInput" ;
@@ -12,7 +20,7 @@ import { Header } from "~/components/Header";
12
20
export const LoginScreen = ( ) => {
13
21
const [ email , setEmail ] = useState ( "" ) ;
14
22
const [ password , setPassword ] = useState ( "" ) ;
15
- const [ isVisible , setIsVisible ] = useState ( true ) ;
23
+ const [ checked , setChecked ] = React . useState ( false ) ;
16
24
17
25
const navigation = useNavigation < any > ( ) ;
18
26
const { setUser } = useAuthentication ( ) ;
@@ -25,7 +33,7 @@ export const LoginScreen = () => {
25
33
}
26
34
27
35
function toggleSecureIcon ( ) {
28
- setIsVisible ( ! isVisible ) ;
36
+ setChecked ( ! checked ) ;
29
37
}
30
38
31
39
const theme = useTheme ( ) ;
@@ -41,19 +49,27 @@ export const LoginScreen = () => {
41
49
returnKeyType = "next"
42
50
keyboardType = "email-address"
43
51
autoComplete = "email"
52
+ textContentType = "emailAddress"
53
+ autoCapitalize = "none"
44
54
/>
45
55
< FormInput
46
56
label = "Password"
47
57
value = { password }
48
- secureTextEntry = { isVisible }
58
+ secureTextEntry = { ! checked }
49
59
onChangeText = { ( value ) => setPassword ( value ) }
50
60
autoComplete = "password"
51
- right = {
52
- < TextInput . Icon
53
- onPress = { toggleSecureIcon }
54
- icon = { isVisible ? "eye-off" : "eye" }
55
- />
56
- }
61
+ />
62
+ < Checkbox . Item
63
+ label = "Show Password"
64
+ onPress = { toggleSecureIcon }
65
+ status = { checked ? "checked" : "unchecked" }
66
+ labelStyle = { { textAlign : "left" } }
67
+ style = { {
68
+ paddingVertical : 0 ,
69
+ paddingHorizontal : 0 ,
70
+ } }
71
+ position = "leading"
72
+ mode = "android"
57
73
/>
58
74
< Button
59
75
onPress = { handleLogin }
0 commit comments