From 627dde7479eeed29d7b65bf8965069b08b7d9e52 Mon Sep 17 00:00:00 2001 From: Zeya Peng Date: Wed, 24 Jun 2026 12:42:43 -0700 Subject: [PATCH] do not post callback in AnimationBackendChoreographer.kt if featureflag is off Summary: ## Changelog: [Internal] - do not post callback in AnimationBackendChoreographer.kt if featureflag is off AnimationBackendChoreographer is initialized in android regardless of featureflag, and it posts no-op per frame callbacks regardless, which is not ideal Differential Revision: D109607144 --- .../react/fabric/AnimationBackendChoreographer.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/AnimationBackendChoreographer.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/AnimationBackendChoreographer.kt index 7bdeb518d808..c1134664e1a9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/AnimationBackendChoreographer.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/AnimationBackendChoreographer.kt @@ -10,6 +10,7 @@ package com.facebook.react.fabric import com.facebook.proguard.annotations.DoNotStripAny import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.UiThreadUtil +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags import com.facebook.react.modules.core.ReactChoreographer import com.facebook.react.uimanager.GuardedFrameCallback import java.util.concurrent.atomic.AtomicBoolean @@ -41,9 +42,11 @@ internal class AnimationBackendChoreographer( private val paused: AtomicBoolean = AtomicBoolean(true) init { - // Register the self-reposting callback once, on the UI thread, so the - // callback queues are only ever mutated from the UI thread. - UiThreadUtil.runOnUiThread { postCallback() } + if (ReactNativeFeatureFlags.useSharedAnimatedBackend()) { + // Register the self-reposting callback once, on the UI thread, so the + // callback queues are only ever mutated from the UI thread. + UiThreadUtil.runOnUiThread { postCallback() } + } } fun resume() {