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
This commit is contained in:
Emily Janzer 2020-01-03 15:14:04 -08:00 коммит произвёл Facebook Github Bot
Родитель d6800616f2
Коммит 173e7835c6
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -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);
}
}
}