Skip to content

Commit 6e0e712

Browse files
dmytrorykunfacebook-github-bot
authored andcommitted
Bring back shouldSkipStateUpdatesForLoopingAnimations feature flag (facebook#46598)
Summary: Pull Request resolved: facebook#46598 Changelog: [General][Changed] - Bring back shouldSkipStateUpdatesForLoopingAnimations feature flag Facebook Also bring back `skip_state_updates_for_looping_animations` MC. This will allow the experiment to participate in a holdout properly. Reviewed By: GijsWeterings Differential Revision: D63252185 fbshipit-source-id: 89bc9321b12f07bd9b3b52c4fc1021d34594ebc0
1 parent b846f94 commit 6e0e712

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

packages/react-native/Libraries/Animated/animations/Animation.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ export default class Animation {
110110
if (value != null) {
111111
animatedValue.__onAnimatedValueUpdateReceived(value);
112112

113-
if (this.__isLooping) {
113+
if (
114+
ReactNativeFeatureFlags.shouldSkipStateUpdatesForLoopingAnimations() &&
115+
this.__isLooping
116+
) {
114117
return;
115118
}
116119

packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,15 @@ const definitions: FeatureFlagDefinitions = {
553553
purpose: 'release',
554554
},
555555
},
556+
shouldSkipStateUpdatesForLoopingAnimations: {
557+
defaultValue: false,
558+
metadata: {
559+
dateAdded: '2024-07-25',
560+
description:
561+
'If the animation is within Animated.loop, we do not send state updates to React.',
562+
purpose: 'experimentation',
563+
},
564+
},
556565
shouldUseAnimatedObjectForTransform: {
557566
defaultValue: false,
558567
metadata: {

packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<79bdedd5a09ba284cdaa2e4f40ffd2fd>>
7+
* @generated SignedSource<<b7171b730c25a06f13d74306e1bffd8b>>
88
* @flow strict
99
*/
1010

@@ -36,6 +36,7 @@ export type ReactNativeFeatureFlagsJsOnly = {
3636
enableAnimatedPropsMemo: Getter<boolean>,
3737
enableOptimisedVirtualizedCells: Getter<boolean>,
3838
isLayoutAnimationEnabled: Getter<boolean>,
39+
shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean>,
3940
shouldUseAnimatedObjectForTransform: Getter<boolean>,
4041
shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean>,
4142
shouldUseSetNativePropsInFabric: Getter<boolean>,
@@ -146,6 +147,11 @@ export const enableOptimisedVirtualizedCells: Getter<boolean> = createJavaScript
146147
*/
147148
export const isLayoutAnimationEnabled: Getter<boolean> = createJavaScriptFlagGetter('isLayoutAnimationEnabled', true);
148149

150+
/**
151+
* If the animation is within Animated.loop, we do not send state updates to React.
152+
*/
153+
export const shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean> = createJavaScriptFlagGetter('shouldSkipStateUpdatesForLoopingAnimations', false);
154+
149155
/**
150156
* Enables use of AnimatedObject for animating transform values.
151157
*/

0 commit comments

Comments
 (0)