Skip to content

Unable to animate arbitrary style props with NativeAnimated #9255

Open
@rozele

Description

@rozele

Problem Description

The core RN Animated API affords users the ability to animate arbitrary props. For example, you can animate a square to a circle by animating the borderRadius prop.

This functionality is not supported by the current implementation of NativeAnimated in react-native-windows.

Steps To Reproduce

  1. Add an example to RNTester > Native Animated Example that animates an arbitrary prop, e.g., borderRadius:
  {
    title: 'Animate arbitrary prop',
    render: function (): React.Node {
      return (
        <Tester type="timing" config={{duration: 4000}}>
          {(anim) => (
            <Animated.View
              style={[
                styles.block,
                {
                  borderRadius: anim.interpolate({
                    inputRange: [0, 0.5, 1],
                    outputRange: [0, 25, 0],
                  }),
                },
              ]}
            />
          )}
        </Tester>
      );
    },
  }
  1. Run example.
  2. Native animation does nothing, JS driven animation works correctly.

Expected Results

The native-driven example should match the behavior of the JS-driven example.

CLI version

npx react-native --version

Environment

npx react-native info

Target Platform Version

No response

Target Device(s)

No response

Visual Studio Version

No response

Build Configuration

No response

Snack, code example, screenshot, or link to a repository

React.Native.Playground.Win32.2021-12-08.14-10-08.mp4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions