Skip to content
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

Merged
merged 5 commits into from
Jan 20, 2017

Conversation

j-francisco
Copy link
Contributor

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).

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();
Copy link
Member

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.

Copy link
Contributor Author

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.
Copy link
Member

@TheSharpieOne TheSharpieOne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eddywashere eddywashere merged commit 6c5621f into reactstrap:master Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants