Skip to content

feat(Collapse): Add onOpened and onClosed events (#277)#301

Merged
eddywashere merged 5 commits intoreactstrap:masterfrom
j-francisco:collapse-events
Jan 20, 2017
Merged

feat(Collapse): Add onOpened and onClosed events (#277)#301
eddywashere merged 5 commits intoreactstrap:masterfrom
j-francisco:collapse-events

Conversation

@j-francisco
Copy link
Copy Markdown
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).
Comment thread src/Collapse.js Outdated

onOpened() {
if (this.props.onOpened) {
this.props.onOpened();
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

3 participants