Open potapovnikita opened 1 year ago
The same issue I have.
Could you make it possible to provide custom header as a normal JSX component like the same way with Custom Input
. Then maybe the internal hooks work in the custom header component.
<DatePicker
// the rest props are omitted
renderCustomHeader={<DatePickerHeader />}
/>
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 10 days.
Still same issue.
Extending @talatkuyuk's answer
This works for me when the props are passed. Now hook usage is possible in the header component.
<DatePicker
// the rest props are omitted
renderCustomHeader={(p) => <DatePickerHeader {...p} />}
/>
Before you start - checklist
Description
Invalid hook call in renderCustomHeader prop.
When I'm passing ReactComponent (with own useState hook inside) in renderCustomHeader prop, i'm getting error Invalid hook call......
Example:
where DatePickerHeader is React Component:
Steps to reproduce
Expected behavior
Should working without error Invalid hook call
Actual behavior
There is error in console Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: ......
Additional information
No response
Environment