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:
Родитель
5ebef01e9b
Коммит
e6d498b99b
|
@ -467,6 +467,11 @@ public class NativeViewHierarchyManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
View rootView = (View) RootViewUtil.getRootView(v);
|
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);
|
rootView.getLocationInWindow(outputBuffer);
|
||||||
int rootX = outputBuffer[0];
|
int rootX = outputBuffer[0];
|
||||||
int rootY = outputBuffer[1];
|
int rootY = outputBuffer[1];
|
||||||
|
|
|
@ -26,7 +26,9 @@ public class RootViewUtil {
|
||||||
return (RootView) current;
|
return (RootView) current;
|
||||||
}
|
}
|
||||||
ViewParent next = current.getParent();
|
ViewParent next = current.getParent();
|
||||||
Assertions.assertNotNull(next);
|
if (next == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Assertions.assertCondition(next instanceof View);
|
Assertions.assertCondition(next instanceof View);
|
||||||
current = (View) next;
|
current = (View) next;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче