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
This commit is contained in:
Zeya Peng authored and meta-codesync[bot] committed 2026-06-25 07:29:36 -07:00
1 parent 886faee2d1
commit 368a8f294e
1 file changed
+6 -3
@@ -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() {