-
-
Notifications
You must be signed in to change notification settings - Fork 226
regression when using animation from 0.4.3 #13
Comments
I liked more the old |
Sorry about the API changes, I think it's finally in a stable spot now. Next release should be 1.0.0. @FezVrasta I knew you weren't going to like the change! haha. I think this way will be better in the long run since it's more explicit with what's going on. @chrisdrackett what isn't working? If you use just use a I'm guessing that you'll probably need to pass down some info from |
I think I know what it is! Right now, no props get passed through when using a child function so they get lost in the Popper component. I'll try and get this fixed ASAP. Thanks for filing an issue! Thoughts on what it should look like? Thinking something like:
or
|
Why do we need to pass a function down as children? Wouldn't a component work the same? |
Not always 😕 because we need access to the DOM node, we can't pass a ref down reliably since it could point to a component's class instance if it doesn't return an element. When we use |
honestly I also miss just being able to use I think either of the above would work. I personally prefer the second example (with |
I feel you on it, I really liked I think I'm going to go with just
|
@FezVrasta can I have a transform above a Popper? Something like this will not reposition the Popper anymore, it just stays where it originally was. I'm running into issues trying to get animations working 😩 I think we need to explicitly pass all the props down since in a case like this if an animation was messing with transforms then it needs to live above or below the Popper. |
@chrisdrackett so I finally got animations working with a Popper using React Motion UI Pack. It looks like the following.. <Transition
component={false}
enter={{ opacity: 1, scale: 1 }}
leave={{ opacity: 0, scale: 0.9 }}
>
{this.state.isOpen &&
<Popper>
{({ popperProps, restProps }) => (
<div {...popperProps}>
<div {...restProps}> // animations coming through here
Animated Popper 🎉
</div>
</div>
)}
</Popper>}
</Transition> If the animation is using a transform it will need to be applied to a seperate element since it will stomp on the Popper logic. Does that look good to you? |
yeah, if not a little messy. I'm curious about the use cases where a user would need access to |
I guess that in that case you can just use Popper without using the functional child, correct? |
Yes, this is exactly what I do at my work. I use a Popper as the outer element and just let that care about positioning. Then the inner element can be whatever user defined component. If you're doing something like that, then you shouldn't even need a child function, that's best used for gluing the However, if you do want to still allow access to the ref and you're using a child function, you could do something like the following...
It's a little messy, but I'm not sure of any other way without |
I'll play with it more when you push your work. I have a couple ideas, but they are hard to test at the moment :D |
Should be good to go now with the latest release 2109ac0 🎉 feel free to reopen or file any new issues you find 😅 thanks for working through it with me! |
I was using the following code in 0.4.3 without any issues:
I rewrote this code after updating to 0.5.0:
I'm sure there is a possibility I'm doing something wrong and I'll keep hacking on it, but I figured it was worth raising!
The text was updated successfully, but these errors were encountered: