Skip to content

Conversation

@rozele
Copy link
Contributor

@rozele rozele commented Dec 20, 2021

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Why

In the RN Animated API, the offset value should not change unless explicitly set by the user (or extract offset / flatten offset is called on the value node). In the previous composition implementation for NativeAnimated, the offset property in the CompositionPropertySet was animated, meaning if the user specified an offset value, its initial value was assumed to be zero for the spring and decay drivers, and more problematically, the animation needed to implicitly flatten the offset at the end of the animation.

Resolves #9256

What

This change keeps a fixed offset during animations and instead animates the raw value.

Testing

RNTester animations still behave correctly:

React.Native.Playground.Win32.2021-12-20.12-43-07.mp4

Breaking Change

This is marked as a breaking change, but only if people have relied on buggy behavior where the offset value is implicitly flattened at the end of an animation. Since this is not how animations are supposed to behave on other platforms, the fact that this is "breaking" can probably be ignored by most, but it may still be useful to call out the change in release notes.

Microsoft Reviewers: Open in CodeFlow

In the RN Animated API, the offset value should not change unless
explicitly set by the user (or extract offset / flatten offset is called
on the value node). In the previous composition implementation for
NativeAnimated, the offset property in the CompositionPropertySet was
animated, meaning if the user specified an offset value, its initial
value was assumed to be zero for the spring and decay drivers, and more
problematically, the animation needed to implicitly flattened at the end
of the animation.

This change keeps a fixed offset during animations and instead animates
the raw value.

Fixes microsoft#9256
@rozele rozele requested a review from a team as a code owner December 20, 2021 17:41
@acoates-ms acoates-ms merged commit 9b88d32 into microsoft:main Jan 7, 2022
@rozele rozele deleted the issue9256 branch January 7, 2022 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NativeAnimated commandeers the animated value offset

3 participants