Skip to content

Instantly share code, notes, and snippets.

@magician11
Created July 19, 2023 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magician11/d7df9cf18c4b2f94c852829dd035f7a3 to your computer and use it in GitHub Desktop.
Save magician11/d7df9cf18c4b2f94c852829dd035f7a3 to your computer and use it in GitHub Desktop.
PasswordInput component for react-native-paper
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;
@magician11
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment