Refactor LayoutAnimation to use ReactNativeFeatureFlags

Summary:
This diff refactors LayoutAnimation to use ReactNativeFeatureFlags.ENABLE_LAYOUT_ANIMATION to enable / disable this feature

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D34349648

fbshipit-source-id: 90d1db6560867e44eeffbf03e5a84edadcdd55f9
This commit is contained in:
David Vacca
2022-02-18 18:23:00 -08:00
committed by Facebook GitHub Bot
parent 33aba77456
commit 05b4570d3f
2 changed files with 8 additions and 2 deletions
+4 -2
View File
@@ -19,6 +19,7 @@ import type {
} from '../Renderer/shims/ReactNativeTypes';
import Platform from '../Utilities/Platform';
import ReactNativeFeatureFlags from '../ReactNative/ReactNativeFeatureFlags';
// Reexport type
export type LayoutAnimationConfig = LayoutAnimationConfig_;
@@ -26,10 +27,11 @@ export type LayoutAnimationConfig = LayoutAnimationConfig_;
type OnAnimationDidEndCallback = () => void;
type OnAnimationDidFailCallback = () => void;
let isLayoutAnimationEnabled: boolean = true;
let isLayoutAnimationEnabled: boolean =
ReactNativeFeatureFlags.isLayoutAnimationEnabled();
function setEnabled(value: boolean) {
isLayoutAnimationEnabled = value;
isLayoutAnimationEnabled = isLayoutAnimationEnabled;
}
/**
@@ -11,6 +11,10 @@
'use strict';
export type FeatureFlags = {|
/**
* Function used to enable / disabled Layout Animations in React Native.
* Default value = true.
*/
isLayoutAnimationEnabled: () => boolean,
|};