Bug: Passing onChange to Custom Dropdown component #1832
-
Bug descriptionI am trying to create a custom Dropdown component and continue to receive when passing the value into the props.onChange:
To reproducehttps://codesandbox.io/s/react-daypicker-forked-7v4skw Steps
Expected behaviorWhat needs to be passed into the onChange? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@nickcanarelli when implementing a custom navigation, you have two options:
Your
See the working types here https://codesandbox.io/s/react-daypicker-forked-jwcctf?file=/src/Dropdown.tsx which fix your issue. Thanks for reporting your experience, definitely it helps! |
Beta Was this translation helpful? Give feedback.
@nickcanarelli when implementing a custom navigation, you have two options:
Dropdown
via thecomponents
prop and add the proper casting to work with an HTML select with HTML option elements. I understand this is more complex than thought, hopefully will be fixed in next release.Caption
via thecomponents
and implement your own navigation – without the limits of theDropdown
: https://react-day-picker.js.org/guides/custom-components#custom-caption. This is the preferred method when working with custom HTML dropdown.Your
Dropwdown.tsx
there has no type annotations, so you can't see where are the issues:DropdownProps
type to make sure your custom Dropdown get…