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

Can you explain the implementation choices? #14

Open
dustingetz opened this issue Sep 4, 2015 · 1 comment
Open

Can you explain the implementation choices? #14

dustingetz opened this issue Sep 4, 2015 · 1 comment

Comments

@dustingetz
Copy link

Hi Ryan, I am studying react-magic-move and would like to understand why you need a portal with manually positioned children. Can you write a few sentences about why it's coded this way and what isn't possible with just css transitions?

@everdimension
Copy link

I can answer this. You cannot animate a dom element just changing it's place in the DOM. There's no animation or animation event for that.

The only way to animate positions of DOM elements is if they are absolutely positioned and have left and right properties set. Those properties are animateable. But layout with absolutely positined elements is terrible to maintain, because the parent element now has no hight (which you can manually add) and changes in browser's size also have to be manually setup, which might never give a pretty result.

So what this library does is let you have elements styled and positioned in any way you want, and it creates those absolutely positioned clones for you. And animates them when it sees that your elements have changed their positions in the dom.

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

2 participants