From 4b035d820d3f1c3c9a98ce4f55bcc95a7ab064bf Mon Sep 17 00:00:00 2001 From: Dmitry Rykun Date: Wed, 18 Sep 2024 05:28:07 -0700 Subject: [PATCH] Ship shouldSkipStateUpdatesForLoopingAnimations (#46556) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46556 Changelog: [General][Breaking] - Native looping animation will not send React state update every time it finishes. Facebook The QE shows neutral results, and has been shipped https://www.internalfb.com/intern/qe2/rn_surface_loading_performance/skip_state_updates_for_looping_animations/wrapup/config Reviewed By: javache Differential Revision: D62877191 fbshipit-source-id: 5b04105b3a33535c0da3bc7835098a9c4571d482 --- .../Libraries/Animated/animations/Animation.js | 5 +---- .../featureflags/ReactNativeFeatureFlags.config.js | 5 ----- .../src/private/featureflags/ReactNativeFeatureFlags.js | 8 +------- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/packages/react-native/Libraries/Animated/animations/Animation.js b/packages/react-native/Libraries/Animated/animations/Animation.js index 8152fa30bccb3b..8ee76a3dcf00bd 100644 --- a/packages/react-native/Libraries/Animated/animations/Animation.js +++ b/packages/react-native/Libraries/Animated/animations/Animation.js @@ -110,10 +110,7 @@ export default class Animation { if (value != null) { animatedValue.__onAnimatedValueUpdateReceived(value); - if ( - ReactNativeFeatureFlags.shouldSkipStateUpdatesForLoopingAnimations() && - this.__isLooping - ) { + if (this.__isLooping) { return; } diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index c43306344ca7c7..def31a0a99ad52 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -318,11 +318,6 @@ const definitions: FeatureFlagDefinitions = { description: 'Function used to enable / disabled Layout Animations in React Native.', }, - shouldSkipStateUpdatesForLoopingAnimations: { - defaultValue: false, - description: - 'If the animation is within Animated.loop, we do not send state updates to React.', - }, shouldUseAnimatedObjectForTransform: { defaultValue: false, description: diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 19e42104b5be01..4bbbaa9f8eae8e 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<9d8783e80d0d82c086d9477aeb58d033>> * @flow strict */ @@ -36,7 +36,6 @@ export type ReactNativeFeatureFlagsJsOnly = { enableAnimatedPropsMemo: Getter, enableOptimisedVirtualizedCells: Getter, isLayoutAnimationEnabled: Getter, - shouldSkipStateUpdatesForLoopingAnimations: Getter, shouldUseAnimatedObjectForTransform: Getter, shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter, shouldUseSetNativePropsInFabric: Getter, @@ -145,11 +144,6 @@ export const enableOptimisedVirtualizedCells: Getter = createJavaScript */ export const isLayoutAnimationEnabled: Getter = createJavaScriptFlagGetter('isLayoutAnimationEnabled', true); -/** - * If the animation is within Animated.loop, we do not send state updates to React. - */ -export const shouldSkipStateUpdatesForLoopingAnimations: Getter = createJavaScriptFlagGetter('shouldSkipStateUpdatesForLoopingAnimations', false); - /** * Enables use of AnimatedObject for animating transform values. */