Skip to content

Commit 368a8f2

Browse files
zeyapmeta-codesync[bot]
authored andcommitted
do not post callback in AnimationBackendChoreographer.kt if featureflag is off (#57326)
Summary: Pull Request resolved: #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
1 parent 886faee commit 368a8f2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/AnimationBackendChoreographer.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ package com.facebook.react.fabric
1010
import com.facebook.proguard.annotations.DoNotStripAny
1111
import com.facebook.react.bridge.ReactApplicationContext
1212
import com.facebook.react.bridge.UiThreadUtil
13+
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
1314
import com.facebook.react.modules.core.ReactChoreographer
1415
import com.facebook.react.uimanager.GuardedFrameCallback
1516
import java.util.concurrent.atomic.AtomicBoolean
@@ -41,9 +42,11 @@ internal class AnimationBackendChoreographer(
4142
private val paused: AtomicBoolean = AtomicBoolean(true)
4243

4344
init {
44-
// Register the self-reposting callback once, on the UI thread, so the
45-
// callback queues are only ever mutated from the UI thread.
46-
UiThreadUtil.runOnUiThread { postCallback() }
45+
if (ReactNativeFeatureFlags.useSharedAnimatedBackend()) {
46+
// Register the self-reposting callback once, on the UI thread, so the
47+
// callback queues are only ever mutated from the UI thread.
48+
UiThreadUtil.runOnUiThread { postCallback() }
49+
}
4750
}
4851

4952
fun resume() {

0 commit comments

Comments
 (0)