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

CSSTransitionGroup does not animate if child calls getBoundingClientRect() on componentDidMount #3672

Closed
shaharz opened this issue Apr 15, 2015 · 3 comments

Comments

@shaharz
Copy link

shaharz commented Apr 15, 2015

Possibly not a React bug, but I haven't been able to reproduce in vanilla JS/HTML/CSS so far.

Demo: http://jsfiddle.net/cjqg0y48/1/

I encountered this when I tried to fade in a component that contains react-swipe which uses a plain JS library under the hood. It seems like the call it makes to getBoundingClientRect() magically neutralizes the transition, causing it to have no effect.

One workaround seems to be deferring the getBoundingClientRect() call using setTimeout. (Thanks GreenJello on #reactjs)

@shaharz shaharz changed the title CSSTransitionGroup has no effect if child calls getBoundingClientRect() on componentDidMount CSSTransitionGroup does not animate if child calls getBoundingClientRect() on componentDidMount Apr 19, 2015
@kriscarle
Copy link

I'm also seeing this while using https://github.com/akiran/react-slick The width is zero during componentDidMount. I'm using react 0.13.3.

This is the line that is returning zero

var trackWidth = this.refs.track.getDOMNode().getBoundingClientRect().width;

@kriscarle
Copy link

The problem in my case was that I had hidden the parent container with display:none and was attempting to fade it in, but display: none makes the widths zero. I'm trying a different approach.

@gaearon
Copy link
Collaborator

gaearon commented Jan 27, 2017

I’m going to close since we don’t plan any more changes to TransitionGroup in React repo. Instead, it now is maintained by the community, and you can file an issue in the new repository if this is still affecting you. Thanks!

@gaearon gaearon closed this as completed Jan 27, 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

No branches or pull requests

4 participants