-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Collapse): Add onOpened and onClosed events (#277) #301
Conversation
Allow passing in onOpened and onClosed props as functions that are triggered after the Collapse component has finished opening or closing. Useful for performing an action that relies on the new height of the page after a Collapse component has opened or closed (such as scrolling).
componentWillUnmount() { | ||
clearTimeout(this.transitionTag); | ||
} | ||
|
||
onOpened() { | ||
if (this.props.onOpened) { | ||
this.props.onOpened(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about defaulting these props to noop? (() => {}
) then there would not be a need for these helper function nor the need to bind them in the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I just pushed the change.
Remove the need for the onOpened and onClosed helper functions and call the props directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Allow passing in onOpened and onClosed props as functions that are triggered after the Collapse component has finished opening or closing. Useful for performing an action that relies on the new height of the page after a Collapse component has opened or closed (such as scrolling).