Extend MountingManager to not fail when trying to update event emitter of a non created view

Summary:
This diff extends the MountingManager to not fail when trying to update event emitter of a non created view. This is necessary as intermediate step to remove virtual nodes out of the RN Fabric Android
changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D20048998

fbshipit-source-id: c2a3633400ac67c2f46ec52ed3ad80289ff6aeb9
This commit is contained in:
David Vacca
2020-02-21 21:05:35 -08:00
committed by Facebook Github Bot
parent 8c10147ed5
commit d42e2fa92a
@@ -445,7 +445,13 @@ public class MountingManager {
@UiThread
public void updateEventEmitter(int reactTag, @NonNull EventEmitterWrapper eventEmitter) {
UiThreadUtil.assertOnUiThread();
ViewState viewState = getViewState(reactTag);
ViewState viewState = mTagToViewState.get(reactTag);
if (viewState == null) {
// TODO T62717437 - Use a flag to determine that these event emitters belong to virtual nodes
// only.
viewState = new ViewState(reactTag, null, null);
mTagToViewState.put(reactTag, viewState);
}
viewState.mEventEmitter = eventEmitter;
}