Skip to content

[bug]: Different configs per property not possible in useTransition()  #2136

@hatsumatsu

Description

@hatsumatsu

Which react-spring target are you using?

  • @react-spring/web
  • @react-spring/three
  • @react-spring/native
  • @react-spring/konva
  • @react-spring/zdog

What version of react-spring are you using?

9.6.0

What's Wrong?

When using useTransition it does not seem to be possible to have different spring configs per property like stated in https://www.react-spring.dev/docs/advanced/config#config-per-springvalue .

To Reproduce

Consider this simple transition:

const transitions = useTransition(data, {
    from: { opacity: 0, y: 2 },
    enter: { opacity: 1, y: 0 },
    leave: { opacity: 0, y: -2 },
    config: (key) => {
        return key === 'y' config.wobbly : { duration: 600 };
    },
});

https://www.react-spring.dev/docs/advanced/config#config-per-springvalue states that a function-based config has access to the key of the animated property. In case of useTransition() the passed variable holds the value of data.

Expected Behaviour

We have access to the property key in function-based configs.

Link to repo

_

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corerelates to core classes // parts of the librarykind: bugSomething isn't workingrelease: major

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions