Skip to content

Commit cc8702d

Browse files
authored
Lost the formatting method call in checked field getter (#859)
Fix issues #858
1 parent 2b1e985 commit cc8702d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/useField.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,16 @@ function useField<FormValues: FormValuesShape>(
216216
return value
217217
},
218218
get checked() {
219+
let value = state.value;
219220
if (type === 'checkbox') {
221+
value = format(value, name)
220222
if (_value === undefined) {
221-
return !!state.value
223+
return !!value
222224
} else {
223-
return !!(Array.isArray(state.value) && ~state.value.indexOf(_value))
225+
return !!(Array.isArray(value) && ~value.indexOf(_value))
224226
}
225227
} else if (type === 'radio') {
226-
return state.value === _value
228+
return format(value, name) === _value
227229
}
228230
return undefined
229231
},

0 commit comments

Comments
 (0)