Skip to content

Remove transform on animation end #747

Closed
@arvigeus

Description

@arvigeus

🐛 Bug Report

What I am trying to do is to remove the transform property after the animation is complete. I found out I can set a second value in enter function, but it tries to animate it from perspective(1000px) rotateY(0deg) to none, which results in crash. Transform interferes with position: fixed of a child element and it needs to be none (long live CSS bugs!). The only thing I can think of is to chain transition elements and use immediate on the second, but this sounds like an overkill.

To Reproduce

<Transition
    native
    initial={null}
    items={location}
    keys={location => location.pathname}
    from={{ opacity: 0, transform: "perspective(1000px) rotateY(180deg)" }}
    enter={[
        { opacity: 1, transform: "perspective(1000px) rotateY(0deg)" },
        { transform: "none", config: { immediate: true } }
    ]}
    leave={{ opacity: 0, position: "absolute", transform: "perspective(1000px) rotateY(-180deg)", pointerEvents: "none" }}
>
    {location => style => <animated.div style={style}>{children(location)}</animated.div> }
</Transition>

(tested with { transform: "none", immediate: true } as well)

Expected behavior

transform: none

Link to reproduce

https://gist.github.com/arvigeus/8ae09dc28cfd13b9f4e42418dd0eaa99

Environment

  • react-spring v8.0.27
  • react v16.8.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions