-
Notifications
You must be signed in to change notification settings - Fork 139
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
Nesting Flippers #81
Comments
Hi, thanks for pinpointing this problem. The code you found,"filterFlipDescendants", is some (probably overly complex) code for enabling nested staggers, and it causes the problem by not selecting direct children correctly. I have a beta release that should fix it, testing it on your example (which i will add to the repo as well): it seems to fix the problem: https://codesandbox.io/s/react-flip-toolkit-wrong-width-696xu I'll try to make a patch release soon. |
Wow, that is azaming! |
Hey @mayorandrew On what version did you manage to fix your nested Flipper problem? |
Hi @DimitryDushkin, this problem in this issue is fixed in version 6.6.4 |
Thanks! Turned out my problem was in constantly re-mounting Flipper component, so nested thing didn't work. |
I've got an interesting use case for this library, where I nest two flippers in order to have multiple independent
flipKey
s instead of just one global.I have a
Message
component which can be opened or closed. It contains aFlipper
and aFlipped
.Inside a
Message
there are multipleMessageItem
components, each of which can also be opened or closed. Therefore I put a secondFlipper
and aFlipped
inside theMessageItem
component.But the
MessageItem
animation does not work correctly. The inverse transform is applied after rerender, but the item does not animate back to the normal state.If I remove the second
Flipper
and propagate theMessageItem
state up to theMessage
, everything works fine.I've made this codesandbox to show the issue: https://codesandbox.io/s/react-flip-toolkit-wrong-width-fmktp
There are code blocks commented as
case 1
(two Flippers) andcase 2
(one Flipper) in the demo. You can comment them out in order to switch between cases.I think nesting Flippers opens more composability possibilities than having just one Flipper per subtree.
Investigation
In hopes of a quick fix I forked you repo and added new branch
nested-flipper
in which I've added the new demoNestedFlipper
similar to the codesandbox above.I did some quick debugging and nailed the issue down to the following call:
which returns empty array, so the animations are not applied.
I suppose that somewhere there is an assumption that
Flipped
could not be parent ofFlipper
, so thefilterFlipDescendants
does not correctly extract the downmostFlipped
as the topLevelChild of secondFlipper
.I've tried to look into that function but got stuck with the selectors logic for now.
So I've decided to open this issue and possibly get some feedback before I'll have an opportunity to dig deeper,
The text was updated successfully, but these errors were encountered: