Migrate lookup of EventDispatcher to not depend on UIManagerModule

Summary:
This diff migrates all the lookups of EventDispatcher to not depend on UIManagerModule anymore.
This refactor is necessary because:
- Users running in Fabric / Venice should not load on the UIManagerModule class
- D25858934 will introduce a change that will break all of these callsites

In the migration I'm relying on the method UIManagerHelper.getEventDispatcherFromReactTag() that returns the correct EventDispatcher for a reactTag.

I'm planning to land this change early in the week (to catch potential errors in alpha / beta versions)

As a followup we need to deprecate and prevent developers to continue using getNativeModule(UIManagerModule.class) moving forward. That will be part of another diff

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D25858933

fbshipit-source-id: e26c99759307517b5bef483274fe0e0d71bb4c6c
This commit is contained in:
David Vacca
2021-01-11 15:41:28 -08:00
committed by Facebook GitHub Bot
parent 6a9525c9b0
commit 5348a98207
8 changed files with 48 additions and 39 deletions
@@ -259,8 +259,7 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
/**
* Test that the mentions input has colors displayed correctly. Removed for being flaky in open
* source, December 2016 public void testMetionsInputColors() throws Throwable { EventDispatcher
* eventDispatcher =
* getReactContext().getNativeModule(UIManagerModule.class).getEventDispatcher(); ReactEditText
* eventDispatcher = UIManagerHelper.getEventEmitterForReactTag(reactContext, tag); ReactEditText
* reactEditText = getViewByTestId("tokenizedInput"); String newText = "#Things and more #things";
* int contentWidth = reactEditText.getWidth(); int contentHeight = reactEditText.getHeight(); int
* start = 0; int count = newText.length();