Created
July 19, 2023 16:53
-
-
Save magician11/d7df9cf18c4b2f94c852829dd035f7a3 to your computer and use it in GitHub Desktop.
PasswordInput component for react-native-paper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
import { TextInput } from 'react-native-paper'; | |
const PasswordInput = ({ password, setPassword }) => { | |
const [showPassword, setShowPassword] = useState(false); | |
return ( | |
<TextInput | |
label="Password" | |
secureTextEntry={!showPassword} | |
right={ | |
<TextInput.Icon | |
icon={showPassword ? 'eye-off' : 'eye'} | |
onPress={() => setShowPassword(!showPassword)} | |
/> | |
} | |
value={password} | |
onChangeText={text => setPassword(text)} | |
/> | |
); | |
}; | |
export default PasswordInput; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Demo: https://snack.expo.dev/@magician11/passwordinput