Comments (2)
I managed to fix my test cases with this, but it doesn't work with existing test cases.
diff --git a/src/useController.ts b/src/useController.ts
index 9f81698a..574be9aa 100644
--- a/src/useController.ts
+++ b/src/useController.ts
@@ -135,6 +135,7 @@ export function useController<
target: {
value: getEventValue(event),
name: name as InternalFieldName,
+ type: event.target.type,
},
type: EVENTS.CHANGE,
}),
@@ -155,13 +156,8 @@ export function useController<
const field = get(control._fields, name);
if (field && elm) {
- field._f.ref = {
- focus: () => elm.focus(),
- select: () => elm.select(),
- setCustomValidity: (message: string) =>
- elm.setCustomValidity(message),
- reportValidity: () => elm.reportValidity(),
- };
+ field._f.ref = elm;
+ field._f.refs.push(elm);
}
},
},
from react-hook-form.
what i would suggestion, build a radio component which host inputs inside and wrapped with Controller.
from react-hook-form.
Related Issues (20)
- issue: isDirty doesn't work at the first time HOT 5
- issue: Controller is re-rendering fields unnecessarily HOT 2
- issue: Field values become undefined when using values prop in useForm and unmounting HOT 1
- issue: [React Native] React Hook Form causes the QuickType bar on iOS to flicker on every input HOT 1
- issue: useWatch<T> returns wrong types
- RECREATED: Unexpected dirtyFields Output When Using keepDefaultValues Option with reset
- issue: form.reset() prevents form.setValue on field array from working HOT 1
- issue: explicitly registering input disabled: false boolean value does not trigger validation HOT 8
- issue: `useForm`โs `context` doesnโt update with new values HOT 2
- feat: Add additional Types that do not include the ref in FieldValues
- issue: error disappear once submit clicked HOT 1
- issue: `useFormState` no longer updates `validatingFields` HOT 4
- issue: resetField set option defaultValue not update form default value for that field
- issue: (0 , react_hook_form__WEBPACK_IMPORTED_MODULE_14__.useForm) is not a function
- issue: Incorrect value type from useController for nested field under optional parent field
- issue: async validate method not being awaited
- issue: formState.errors does not update on useForm.trigger HOT 1
- Annotate pre-validated field types
- issue: stale closure of register option onChange. HOT 1
- issue: setting `disabled` in `useForm` with `useFieldArray` immediately marks the field array as dirty HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-hook-form.