How to give layout animations default animation props which aren't used during layout animation #2800
Replies: 1 comment
-
Moments after posting this, I realized that wrapping the animating component in
I'm leaving this comment so that hopefully it saves someone else time in the future. |
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
I have a side navigation which I am animating the background of each item with layout animations. The motion component only changes position vertically to align with the currently active item. My code looks something like this:
Some of the navigation items have sub-navigation and so I don't render the animation item when those sub-items are active. However, when the motion component shows up, I'd like it to fade in, as well as fading out when it is unmounted. It seems like any animation props such as
initial
,animate
, andexit
are applied when the layout animation occurs, which causes it to flash each time the position changes. Is there a way to have an animation that occurs only on mount and unmount, and ignored on layout animations that are automatically detected like position?Beta Was this translation helpful? Give feedback.
All reactions