React: expose onTransitionEnd event for react components

Created on 13 Sep 2014  路  13Comments  路  Source: facebook/react

An onTransitionEnd event for components which is normalized across all browsers supporting transitions (and fake it for those that don't using setTimeout). Currently react uses ReactTransitionEvents internally for the TransitionGroup. However this is not useful in cases where you are not adding/removing a view.

DOM

Most helpful comment

This was fixed by #6005 & be in v15.

All 13 comments

:+1: to this. Even as a plugin would be helpful.

:+1: currently using this workaround:

componentDidUpdate: function() {
  this.getDOMNode().addEventListener('transitionend', this.onTransitionEnd, false);
}

Would prefer to do:

<MyComponent onTransitionEnd={this.onTransitionEnd} />

+1

FYI, "faking it" as @shilpan mentioned may be harder than it seems. Apparently the native transitionEnd event does not fire if the transition ends off-screen (in my case, the element is display:none). So it may be better to have React just handle the native behavior for supported browsers, and let us handle any custom code for old browsers.

Any update regarding this feature?

+1

:+1:

:+1:

:+1: that would amazing ;)

:+1:

+1

+1

This was fixed by #6005 & be in v15.

Was this page helpful?
0 / 5 - 0 ratings