You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
794 B
32 lines
794 B
import React, { useState } from "react";
|
|
import FormInput, { FormInputProps } from "./FormInput";
|
|
|
|
export default React.forwardRef<any, FormInputProps>(
|
|
(
|
|
{ onBlur, onChangeText, value, label, ...props },
|
|
ref
|
|
): React.ReactElement => {
|
|
const [showPassword, setShowPassword] = useState(false);
|
|
|
|
const toggleShowPassword = () => {
|
|
setShowPassword(!showPassword);
|
|
};
|
|
|
|
return (
|
|
<FormInput
|
|
label={label}
|
|
beforeIcon="lock"
|
|
afterIcon={showPassword ? "eye" : "eyeo"}
|
|
placeholder="⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆"
|
|
onBlur={onBlur}
|
|
onChangeText={onChangeText}
|
|
value={value}
|
|
onPress={toggleShowPassword}
|
|
secureTextEntry={!showPassword}
|
|
{...ref}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
);
|