From a854563c914ea2dafa332a163c7d0a6353146433 Mon Sep 17 00:00:00 2001 From: Beng Eu Date: Thu, 10 Feb 2022 11:04:16 +0800 Subject: [PATCH] fix: only check `hidden` if `reveal` is true, to correctly handle `reveal` changes --- src/components/Input/Input.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Input/Input.tsx b/src/components/Input/Input.tsx index 4c24fa00..5dbee578 100644 --- a/src/components/Input/Input.tsx +++ b/src/components/Input/Input.tsx @@ -61,7 +61,7 @@ function Input({ ...props }: Props) { const [copyLabel, setCopyLabel] = useState('Copy') - const [hidden, setHidden] = useState(reveal) + const [hidden, setHidden] = useState(true) // if `type` is not assigned, default to text input if (!type) { @@ -125,7 +125,7 @@ function Input({ placeholder={placeholder} ref={inputRef} type={type} - value={hidden ? hiddenPlaceholder : value} + value={reveal && hidden ? hiddenPlaceholder : value} className={inputClasses.join(' ')} {...props} /> @@ -136,7 +136,7 @@ function Input({ size={1} > {error && } - {copy && !hidden ? ( + {copy && !(reveal && hidden) ? (