From 769e36888942e5ff3fdb13fc784e19923b319e50 Mon Sep 17 00:00:00 2001 From: Emily Janzer Date: Thu, 20 Feb 2020 20:17:41 -0800 Subject: [PATCH] Don't subscribe to lifecycle events in NativeAnimatedModule (for now) Summary: Right now, animations don't work on Android in bridgeless mode because NativeAnimatedModule directly uses the UIManagerModule for various things. Previously, I added a bridgeless check to the module's `initialize()` method to avoid adding a listener on the UIManager; in this diff, I'm moving that check so that we also skip adding the lifecycle listener on the context in bridgeless mode, too. I'll remove this check once we come up with a replacement for the UIManagerModule API. Reviewed By: JoshuaGross Differential Revision: D19964171 fbshipit-source-id: 7c461f535e370b0e607c28905c505239cce0e157 --- .../facebook/react/animated/NativeAnimatedModule.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java index 6a044d90066..266cb6037a9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java @@ -127,13 +127,11 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec public void initialize() { ReactApplicationContext reactApplicationContext = getReactApplicationContextIfActiveOrWarn(); - if (reactApplicationContext != null) { + // TODO T59412313 Implement this API on FabricUIManager to use in bridgeless mode + if (reactApplicationContext != null && !reactApplicationContext.isBridgeless()) { reactApplicationContext.addLifecycleEventListener(this); - if (!reactApplicationContext.isBridgeless()) { - // TODO T59412313 Implement this API on FabricUIManager to use in bridgeless mode - UIManagerModule uiManager = reactApplicationContext.getNativeModule(UIManagerModule.class); - uiManager.addUIManagerListener(this); - } + UIManagerModule uiManager = reactApplicationContext.getNativeModule(UIManagerModule.class); + uiManager.addUIManagerListener(this); } }