react-native-hide-show-password-input
Version:
React-Native Component For Password Show/Hide
29 lines (24 loc) • 645 B
JavaScript
// import packages
import React, {useState} from 'react';
import {View, Button} from 'react-native';
import PasswordInputText from 'react-native-hide-show-password-input';
export const App = () => {
const [password, setPassword] = useState('');
let inputRef = null;
return (
<View style={{margin: 20}}>
<PasswordInputText
getRef={(input) => (inputRef = input)}
value={password}
onChangeText={(password) => setPassword(password)}
/>
<Button
title="Clear"
onPress={() => {
if (inputRef) inputRef.clear();
}}
/>
</View>
);
};
export default App;