Close portal from within portal
I've added an extra "reset" button to the portal, which works fine with my app, but I also need it to close the portal.
Is there a way of doing this?
This is my implementation:
(this.clearDate acts similar to this.handleChangeDate).
<DatePicker
selected={ dateFromIso( this.props.list.date, false ) || new Date() }
onChange={ this.handleChangeDate }
withPortal
customInput={ div }
>
<p onClick={ this.clearDate }>Clear</p>
</DatePicker>
I've managed to solve it using ref.current.setOpen method. Couldn't find anything in docs, so I don't know if this is a proper approach, but it works for me 😅
Codesandbox: https://codesandbox.io/s/react-datepicker-close-from-container-v3x18
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.