Fix edge case when we enqueue a pending event to views on stopped surface
Summary: This diff address an edge case when the pending events are enqueued when the surface is stopped. In this case we will reset map that holds view state to null, which will cause NPE. Changelog: [Android][Fixed] - Fix edge case when we enqueue a pending event to views on stopped surface Reviewed By: javache, gorodscy Differential Revision: D36912786 fbshipit-source-id: 3ae5a4b08a0a6bf55538d69ac80a101c2c3d899a
This commit is contained in:
Родитель
8a2be3e143
Коммит
ea7c9f2ad9
|
@ -1092,6 +1092,12 @@ public class SurfaceMountingManager {
|
|||
public void enqueuePendingEvent(int reactTag, ViewEvent viewEvent) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
// When the surface stopped we will reset the view state map. We are not going to enqueue
|
||||
// pending events as they are not expected to be dispatched anyways.
|
||||
if (mTagToViewState == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ViewState viewState = mTagToViewState.get(reactTag);
|
||||
if (viewState == null) {
|
||||
// Cannot queue event without view state. Do nothing here.
|
||||
|
|
Загрузка…
Ссылка в новой задаче