Calendar: InputBox does not re-render when value is programmatically set
Describe the bug
I am using onShow to set the value for the Calendar to new Date(). This does not re-render the InputBox to display the newly set value.
Reproducer
https://codesandbox.io/s/primereact-calendar-defect-bf03sb
PrimeReact version
8.5.0
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
- set
onShowto set value to anything (I'm setting to new Date()) - set
showIconto true - Click icon
- InputBox does not change
Expected behavior
InputBox should reflect the current value of the Calendar component even when set programmatically.
Tricky one related to state and re-renders
Hi @Achill113 , Could you try the same case using onChange unless you have a specific reason to use onShow?
You can see an example I made by forking your example from the link below; https://codesandbox.io/s/primereact-calendar-defect-forked-knnpzi?file=/src/demo/CalendarDemo.tsx