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
This commit is contained in:
Emily Janzer
2020-02-20 20:17:41 -08:00
committed by Facebook Github Bot
parent 3212f7dfe8
commit 769e368889
@@ -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);
}
}