jasonleibowitz / react-add-to-calendar-hoc

Simple Unopinionated React Add to Calendar Button. Bring your own components.
http://leibowitz.me/react-add-to-calendar-hoc/docs/
MIT License
70 stars 40 forks source link

buttonProps does not take an onClick function. Allow handling of dropdown toggle in the props. #54

Open its-segu opened 3 years ago

its-segu commented 3 years ago

Bug Report

buttonProps does not take an "onClick" function

Describe the bug

I have consecutive events you can add to a calendar. If a user opens another 'Add to Calendar' dropdown, any other opened ones should close.

I was attempting to pass an onClick function to buttonProps, but the button is overwritten by another function in your code: onClick={this.handleDropdownToggle}. Please allow the toggle to be passed as a prop, and maybe also allow for the button prop to accept an onClick prop as well.

To Reproduce

Map multiple events to AddToCalendarDropdowns. Notice dropdowns do not toggle based on "active" component.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

Additional context

Add any other context about the problem here.