Fix case where measure is called with a view that is now off screen (and removed from clipping)

Reviewed By: astreet

Differential Revision: D2760119

fb-gh-sync-id: cf2723ddc94de64bba961e9390ce54f39ca4651f
This commit is contained in:
Dave Miller 2015-12-15 10:42:08 -08:00 коммит произвёл facebook-github-bot-5
Родитель 5ebef01e9b
Коммит e6d498b99b
2 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -467,6 +467,11 @@ public class NativeViewHierarchyManager {
}
View rootView = (View) RootViewUtil.getRootView(v);
// It is possible that the RootView can't be found because this view is no longer on the screen
// and has been removed by clipping
if (rootView == null) {
throw new NoSuchNativeViewException("Native view " + tag + " is no longer on screen");
}
rootView.getLocationInWindow(outputBuffer);
int rootX = outputBuffer[0];
int rootY = outputBuffer[1];

Просмотреть файл

@ -26,7 +26,9 @@ public class RootViewUtil {
return (RootView) current;
}
ViewParent next = current.getParent();
Assertions.assertNotNull(next);
if (next == null) {
return null;
}
Assertions.assertCondition(next instanceof View);
current = (View) next;
}