Skip to content
This repository was archived by the owner on Jan 14, 2021. It is now read-only.

Commit 65c5950

Browse files
committed
fix default value and check issue
1 parent 7d07f01 commit 65c5950

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-hook-form-input",
3-
"version": "1.0.10",
3+
"version": "1.0.11-beta.2",
44
"description": "Wrapper component for controlled inputs",
55
"main": "dist/index.js",
66
"module": "dist/index.es.js",

src/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ const RHFInput = React.memo(
5959
const isOnChange = mode === 'onChange';
6060
const isOnBlur = mode === 'onBlur';
6161
const [inputValue, setInputValue] = React.useState(
62-
isCheckbox ? defaultChecked || false : defaultValue || '',
62+
isCheckbox
63+
? defaultChecked === undefined
64+
? false
65+
: defaultChecked
66+
: defaultValue === undefined
67+
? ''
68+
: defaultValue,
6369
);
6470
const valueRef = React.useRef();
6571
const methods = useFormContext();

0 commit comments

Comments
 (0)