score:1
Accepted answer
looks like you need to add onfocus
to please react-hook-form
when it wants to focus the input. see the onfocus
prop of controller
here. note that this prop was removed in rhf v7.
<controller
render={({ ref, ...rest }) => (...)}
name={name}
onfocus={() => {
const inputel = document.queryselector(
`input[name="${name}"]`
);
inputel.focus();
}}
Source: stackoverflow.com
Related Query
- Dynamically add errors when using useFieldArray with React Hook Form
- Error when using useFieldArray append with react-hook-form (Cannot read properties of null (reading 'focus'))
- Error : Cannot read property fetch. Using jest-expo with react native
- Is there a way to set defaultValues in a child component using react hook form with useFieldArray hook - not using the useForm hook?
- Cannot read properties of undefined error when working with an API in React
- Error when Using Custom React Hook in a Multi-Module Project for Tests with Jest
- Keep having the error "TypeError: Cannot read property 'map' of undefined" when using map function in React js
- Cannot read property 'map' of undefined Error when using axios.get inside useEffect hook
- How can I make error validation work in React Hook Form when using template literal in register function?
- Getting a Cannot read property 'style' of null Error When Using useRef Within a React Functional Component
- Cannot find namespace 'ctx' error when creating Context with react - typescript
- Cannot read property '.then' of undefined when testing async action creators with redux and react
- How to test form submission in React with Jest and Enzyme? Cannot read property 'preventDefault' of undefined
- Why does react hook throw the act error when used with fetch api?
- Cannot read property of undefined when using react hooks
- Why do my styled component keyframes error with ts-styled-plugin(9999) in react when using percentage instead of TO/FROM
- React v16- d3 v4, when using mouse from d3-selection will get, TypeError: Cannot read property 'sourceEvent' of null?
- Error Cannot read property 'left' of undefined in React Semantic UI Popup with Styled Component
- Support callback for changing another field value when using React Hook Form validation
- Cannot send form data with axios when using interceptors
- How to fix 'TypeError: Cannot read property 'style' of undefined' error when using material-ui Transitions
- 'Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'writeFile')' error while trying to write to a file with REACT
- When Using Redux Saga with React Get This Error .. Uncaught TypeError: getPosts is not a function
- Faced TypeError: Cannot read property 'counter' of undefined when using Redux in React
- Using React Hook Form with other component
- React hook form useFieldArray typescript error on input name
- cant add image in react getting an error Error: Cannot find module './undefined' when using require
- Uncaught TypeError: Cannot read property 'setDomLayout' of undefined - Error when trying to make print function work with AG-Grid
- Typescript error when use react useState hook with generics
- I am using React Hook Form with Typescript, string does not accept incoming data
More Query from same tag
- Check all weekends dynamically from api data using moment.js in react
- How to pass props/state through Link and Route - react.js
- How to load AJAX in react
- How to retain the width of table columns when hiding columns?
- How to optimize toggling className between different menu items by React?
- Reacts JS/SpringBoot Error: cannot convert string to long on update method in API
- Login with username or email using node and react
- MySQL lost connection with system error: 10060
- passing function as a prop
- Passing properties in react.js / add to favourites
- Accessing React component children props from the parent
- useEffect renders more than once even with empty dependency list
- prettier printWidth setting is not formatting correctly on save
- "serve -s build" returns "serve: command not found"
- TypeError: msg.map is not a function
- How will I get a textboxes values in react js
- React Hook useEffect has a missing dependency
- TypeError: _firebase__WEBPACK_IMPORTED_MODULE_4__.default.auth is not a function
- Webpack SCSS Update Uncaught TypeError
- Reactjs: Using vaueLink with radiobuttons
- RadioGroup will not select when onChange is set that uses useState hook
- React Custom useRequest Hook causes MemoryLeak
- How to give api call once and remove the event listener, once you reached the bottom of page?
- Unit testing React component using Material UI Dialog
- Using the spread operator to change the style of a React component?
- Change React-Select Options Based on Input
- Choosing a random styled component in React.js
- check for empty property value using lodash
- Reading component state just after setting when using useState hook in react
- Triggering transition on componentDidMount