From ee0c69dfa66de2a5dd320a85c6d9294f38733352 Mon Sep 17 00:00:00 2001 From: Ram N Date: Thu, 29 Mar 2018 16:05:10 -0700 Subject: [PATCH] Keep nativeIDs immutable in ReactFindViewUtil Reviewed By: mdvacca Differential Revision: D7430144 fbshipit-source-id: c8e8242c1c3216258e4b8c27623160338e2578d8 --- .../uimanager/util/ReactFindViewUtil.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/util/ReactFindViewUtil.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/util/ReactFindViewUtil.java index 1d0d41d82..cd3104ae3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/util/ReactFindViewUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/util/ReactFindViewUtil.java @@ -129,19 +129,11 @@ public class ReactFindViewUtil { } } - Iterator>> - viewIterator = mOnMultipleViewsFoundListener.entrySet().iterator(); - while (viewIterator.hasNext()) { - Map.Entry> entry = - viewIterator.next(); - Set nativeIds = entry.getValue(); - if (nativeIds.contains(nativeId)) { - entry.getKey().onViewFound(view, nativeId); - nativeIds.remove(nativeId); // remove it from list of NativeIds to search for. - } - if (nativeIds.isEmpty()) { - viewIterator.remove(); - } + for (Map.Entry> entry : mOnMultipleViewsFoundListener.entrySet()) { + Set nativeIds = entry.getValue(); + if (nativeIds != null && nativeIds.contains(nativeId)) { + entry.getKey().onViewFound(view, nativeId); + } } }