From 173e7835c69fab4ec2fe0ef75fb94538c1de601b Mon Sep 17 00:00:00 2001 From: Emily Janzer Date: Fri, 3 Jan 2020 15:14:04 -0800 Subject: [PATCH] Don't add UIManager listener in NativeAnimatedModule when in bridgeless mode Summary: NativeAnimatedModule registers itself as a listener on UIManagerModule, which doesn't exist in bridgeless mode. We now have an API on ReactContext to detect if we're in bridgeless mode, so let's just bail out when that's the case (for now). In the future, we'll need a replacement for this API on FabricUIManager (or somewhere). Changelog: [Internal] Reviewed By: PeteTheHeat, mdvacca Differential Revision: D19185762 fbshipit-source-id: 1cf53304ab58a5b985c8f4806544da51f09e8ba5 --- .../com/facebook/react/animated/NativeAnimatedModule.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 17a2fe11f93..6a044d90066 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java @@ -128,9 +128,12 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec ReactApplicationContext reactApplicationContext = getReactApplicationContextIfActiveOrWarn(); if (reactApplicationContext != null) { - UIManagerModule uiManager = reactApplicationContext.getNativeModule(UIManagerModule.class); reactApplicationContext.addLifecycleEventListener(this); - uiManager.addUIManagerListener(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); + } } }