Skip to content

A new hook for update animations #3804

@ameyms

Description

@ameyms

Problem

For SVG elements that need animation, a 'hook' is needed to tween the element from one configuration to another before React steps in and updates the DOM (and thereby prevents the animation).

My current work-around

For SVG components that need animation, I have to write render method that always returns the same 'dummy' DOM so that React doesn't find any diffs and I can handle all DOM updates myself inside the componentDidUpdate. IMO, this results in a very non-idiomatic ReactJS code because the render method does not have a true representation of what the SVG element will look like after applying state and props.
See this example.

Possible Solution

It would be helpful if components inside transition groups had a componentWillTween(callback) method similar to componentWillEnter etc.

This would be invoked after componentWillUpdate but before componentDidUpdate for components added to an existing TransitionGroup. It would block updates from being flushed to DOM until the callback is called. It would not be called on the initial render of a TransitionGroup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions