From 368a8f294e5381bbaa1eb7b745260273efe1df45 Mon Sep 17 00:00:00 2001 From: Zeya Peng Date: Thu, 25 Jun 2026 07:29:36 -0700 Subject: [PATCH] do not post callback in AnimationBackendChoreographer.kt if featureflag is off (#57326) Summary: Pull Request resolved: https://github.com/react/react-native/pull/57326 ## 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 Reviewed By: OlehMalanchuk Differential Revision: D109607144 fbshipit-source-id: c04b8a45726d555ff7104d902667d7e69f86c0a0 --- .../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 7bdeb518d80..c1134664e1a 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() {