Skip to content

Commit

Permalink
Cleanup the useDebouncedEffect experiment
Browse files Browse the repository at this point in the history
Summary:
This diff cleans up the `use_debounced_effects_for_animated` experiment. It is not shipped because it breaks semantics of Animated.

It also removes the implementation of now unused `useDebouncedEffect` hook.

bypass-github-export-checks

Facebook
Details here https://fb.workplace.com/groups/3611662615830335/permalink/3666119690384627/

Changelog: [Internal]

Reviewed By: bvanderhoof

Differential Revision: D62188361

fbshipit-source-id: ce215cf7dd57e41e02c33760e91808d774bbd919
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed Sep 6, 2024
1 parent 8ebddf3 commit 5e77784
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 190 deletions.
8 changes: 1 addition & 7 deletions packages/react-native/Libraries/Animated/useAnimatedProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import type {EventSubscription} from '../EventEmitter/NativeEventEmitter';

import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
import useDebouncedEffect from '../../src/private/hooks/useDebouncedEffect';
import {isPublicInstance as isFabricPublicInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils';
import useRefEffect from '../Utilities/useRefEffect';
import {AnimatedEvent} from './AnimatedEvent';
Expand Down Expand Up @@ -323,12 +322,7 @@ function useAnimatedPropsLifecycle_passiveEffects(node: AnimatedProps): void {
};
}, []);

const useEffectImpl =
ReactNativeFeatureFlags.shouldUseDebouncedEffectsForAnimated()
? useDebouncedEffect
: useEffect;

useEffectImpl(() => {
useEffect(() => {
node.__attach();
let drivenAnimationEndedListener: ?EventSubscription = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,6 @@ const definitions: FeatureFlagDefinitions = {
description:
'Enables use of AnimatedObject for animating transform values.',
},
shouldUseDebouncedEffectsForAnimated: {
defaultValue: false,
description:
'Use new `useDebouncedEffects` hook for manging animated props lifecycle.',
},
shouldUseRemoveClippedSubviewsAsDefaultOnIOS: {
defaultValue: false,
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<<3693bce1a6719ef03c1c3148230771b4>>
* @generated SignedSource<<0bff47ec5af8ed96d8b2abe351f318f1>>
* @flow strict-local
*/

Expand Down Expand Up @@ -34,7 +34,6 @@ export type ReactNativeFeatureFlagsJsOnly = {
isLayoutAnimationEnabled: Getter<boolean>,
shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean>,
shouldUseAnimatedObjectForTransform: Getter<boolean>,
shouldUseDebouncedEffectsForAnimated: Getter<boolean>,
shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean>,
shouldUseSetNativePropsInFabric: Getter<boolean>,
shouldUseSetNativePropsInNativeAnimationsInFabric: Getter<boolean>,
Expand Down Expand Up @@ -136,11 +135,6 @@ export const shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean> = creat
*/
export const shouldUseAnimatedObjectForTransform: Getter<boolean> = createJavaScriptFlagGetter('shouldUseAnimatedObjectForTransform', false);

/**
* Use new `useDebouncedEffects` hook for manging animated props lifecycle.
*/
export const shouldUseDebouncedEffectsForAnimated: Getter<boolean> = createJavaScriptFlagGetter('shouldUseDebouncedEffectsForAnimated', false);

/**
* removeClippedSubviews prop will be used as the default in FlatList on iOS to match Android
*/
Expand Down

This file was deleted.

23 changes: 0 additions & 23 deletions packages/react-native/src/private/hooks/useDebouncedEffect.js

This file was deleted.

0 comments on commit 5e77784

Please sign in to comment.