Fix crash when resolveView fails to find a view

Reviewed By: yungsters

Differential Revision: D3997107

fbshipit-source-id: 7bf03ff06a6b56d192bab7fa567a11a38148f076
This commit is contained in:
Andrew Y. Chen 2016-10-10 14:40:55 -07:00 committed by Facebook Github Bot
parent a3551b081a
commit 8e91843cc7
1 changed files with 10 additions and 3 deletions

View File

@ -10,6 +10,7 @@
package com.facebook.react.uimanager;
import android.content.res.Resources;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.view.Menu;
@ -64,6 +65,8 @@ import javax.annotation.concurrent.NotThreadSafe;
@NotThreadSafe
public class NativeViewHierarchyManager {
private static final String TAG = NativeViewHierarchyManager.class.getSimpleName();
private final AnimationRegistry mAnimationRegistry;
private final SparseArray<View> mTagsToViews;
private final SparseArray<ViewManager> mTagsToViewManagers;
@ -116,9 +119,13 @@ public class NativeViewHierarchyManager {
public void updateProperties(int tag, ReactStylesDiffMap props) {
UiThreadUtil.assertOnUiThread();
try {
ViewManager viewManager = resolveViewManager(tag);
View viewToUpdate = resolveView(tag);
viewManager.updateProperties(viewToUpdate, props);
} catch (IllegalViewOperationException e) {
Log.e(TAG, "Unable to update properties for view tag " + tag, e);
}
}
public void updateViewExtraData(int tag, Object extraData) {