Trigger nested VirtualizedLists to re-measure if their containing cell's onLayout fires

Reviewed By: sahrens

Differential Revision: D8272040

fbshipit-source-id: c490ffa875bfd0547ac54d214c5ebbeb23c99942
This commit is contained in:
Logan Daniels 2018-06-04 20:49:37 -07:00 committed by Facebook Github Bot
parent 30320f1fed
commit 4435f08771

View File

@ -1074,6 +1074,17 @@ class VirtualizedList extends React.PureComponent<Props, State> {
} else {
this._frames[cellKey].inLayout = true;
}
const childListKeys = this._cellKeysToChildListKeys.get(cellKey);
if (childListKeys) {
for (let childKey of childListKeys) {
const childList = this._nestedChildLists.get(childKey);
childList &&
childList.ref &&
childList.ref.measureLayoutRelativeToContainingList();
}
}
this._computeBlankness();
}
@ -1084,7 +1095,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
}
};
_measureLayoutRelativeToContainingList(): void {
measureLayoutRelativeToContainingList(): void {
UIManager.measureLayout(
ReactNative.findNodeHandle(this),
ReactNative.findNodeHandle(
@ -1113,7 +1124,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
if (this._isNestedWithSameOrientation()) {
// Need to adjust our scroll metrics to be relative to our containing
// VirtualizedList before we can make claims about list item viewability
this._measureLayoutRelativeToContainingList();
this.measureLayoutRelativeToContainingList();
} else {
this._scrollMetrics.visibleLength = this._selectLength(
e.nativeEvent.layout,