mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add a feature flag to disable Fabric layout animations
Summary: tsia Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D34340023 fbshipit-source-id: 61956f1819f1f7e10dc2520c444fa5dd305d1363
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5e88223d85
commit
e912c462eb
@@ -26,6 +26,12 @@ export type LayoutAnimationConfig = LayoutAnimationConfig_;
|
||||
type OnAnimationDidEndCallback = () => void;
|
||||
type OnAnimationDidFailCallback = () => void;
|
||||
|
||||
let isLayoutAnimationEnabled: boolean = true;
|
||||
|
||||
function setEnabled(value: boolean) {
|
||||
isLayoutAnimationEnabled = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the next commit to be animated.
|
||||
*
|
||||
@@ -43,6 +49,10 @@ function configureNext(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isLayoutAnimationEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Since LayoutAnimations may possibly be disabled for now on iOS (Fabric),
|
||||
// or Android (non-Fabric) we race a setTimeout with animation completion,
|
||||
// in case onComplete is never called
|
||||
@@ -181,6 +191,7 @@ const LayoutAnimation = {
|
||||
spring: (configureNext.bind(null, Presets.spring): (
|
||||
onAnimationDidEnd?: OnAnimationDidEndCallback,
|
||||
) => void),
|
||||
setEnabled,
|
||||
};
|
||||
|
||||
module.exports = LayoutAnimation;
|
||||
|
||||
Reference in New Issue
Block a user