Make sure we only queue events when event emitter is null

Summary:
This diff adds an assertion to make sure the pending events are enqueued only when the event emitter is null. This is to avoid unexpected workflow when we queue events but we should just dispatch them.

Changelog:
[Android][Internal] - Make sure we only queue events when event emitter is null

Reviewed By: javache

Differential Revision: D36916482

fbshipit-source-id: fff305615b302ece26bc2482c826b74de4f70266
This commit is contained in:
Xin Chen
2022-06-08 14:19:01 -07:00
committed by Facebook GitHub Bot
parent 77e6bff629
commit 472e0e4a3c
@@ -1103,6 +1103,10 @@ public class SurfaceMountingManager {
// Cannot queue event without view state. Do nothing here.
return;
}
Assertions.assertCondition(
viewState.mEventEmitter == null,
"Only queue pending events when event emitter is null for the given view state");
if (viewState.mPendingEventQueue == null) {
viewState.mPendingEventQueue = new LinkedList<>();
}