LayoutAnimation: don't call non-Fabric configurNext if Fabric is installed

Summary:
If Fabric is "installed"/enabled in the JS VM, only send LayoutAnimations configureNext to Fabric.

This will have no impact unless your app is running Fabric and non-Fabric side-by-side.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D27274016

fbshipit-source-id: 5d709e23968c2b65cc79d5611170fb70a9578953
This commit is contained in:
Joshua Gross
2021-03-23 14:37:25 -07:00
committed by Facebook GitHub Bot
parent 37a03ce80f
commit 334da89b3d
+13 -9
View File
@@ -62,15 +62,6 @@ function configureNext(
(config.duration ?? 0) + 17 /* one frame + 1ms */,
);
if (UIManager?.configureNextLayoutAnimation) {
UIManager.configureNextLayoutAnimation(
config,
onAnimationComplete ?? function() {},
onAnimationDidFail ??
function() {} /* this should never be called in Non-Fabric */,
);
}
// In Fabric, LayoutAnimations are unconditionally enabled for Android, and
// conditionally enabled on iOS (pending fully shipping; this is a temporary state).
const FabricUIManager: FabricUIManagerSpec = global?.nativeFabricUIManager;
@@ -81,6 +72,19 @@ function configureNext(
onAnimationDidFail ??
function() {} /* this will only be called if configuration parsing fails */,
);
return;
}
// This will only run if Fabric is *not* installed.
// If you have Fabric + non-Fabric running in the same VM, non-Fabric LayoutAnimations
// will not work.
if (UIManager?.configureNextLayoutAnimation) {
UIManager.configureNextLayoutAnimation(
config,
onAnimationComplete ?? function() {},
onAnimationDidFail ??
function() {} /* this should never be called in Non-Fabric */,
);
}
}