Ship virtualizedlist remeasure fix

Summary:
This diff ships the virtualizedlist remeasure fix implemented in D27003249 (1bc06f18c6)

For more details about experiment see: https://fb.workplace.com/groups/rn.engineering/permalink/2831770330485832/

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D28072308

fbshipit-source-id: c23c958ca9f2991236cb5a5c02084722aa6de919
This commit is contained in:
David Vacca 2021-04-28 20:15:15 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 7e05480cc3
Коммит 8eeb01686f
2 изменённых файлов: 11 добавлений и 31 удалений

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

@ -20,7 +20,6 @@ const ViewabilityHelper = require('./ViewabilityHelper');
const flattenStyle = require('../StyleSheet/flattenStyle');
const infoLog = require('../Utilities/infoLog');
const invariant = require('invariant');
import VirtualizedListInjection from './VirtualizedListInjection';
import {
keyExtractor as defaultKeyExtractor,
@ -1353,22 +1352,18 @@ class VirtualizedList extends React.PureComponent<Props, State> {
this._scrollMetrics.visibleLength = scrollMetrics.visibleLength;
this._scrollMetrics.offset = scrollMetrics.offset;
if (
VirtualizedListInjection?.unstable_enableVirtualizedListRemeasureChildrenIfNeeded
) {
// If metrics of the scrollView changed, then we triggered remeasure for child list
// to ensure VirtualizedList has the right information.
this._cellKeysToChildListKeys.forEach(childListKeys => {
if (childListKeys) {
for (let childKey of childListKeys) {
const childList = this._nestedChildLists.get(childKey);
childList &&
childList.ref &&
childList.ref.measureLayoutRelativeToContainingList();
}
// If metrics of the scrollView changed, then we triggered remeasure for child list
// to ensure VirtualizedList has the right information.
this._cellKeysToChildListKeys.forEach(childListKeys => {
if (childListKeys) {
for (let childKey of childListKeys) {
const childList = this._nestedChildLists.get(childKey);
childList &&
childList.ref &&
childList.ref.measureLayoutRelativeToContainingList();
}
});
}
}
});
}
},
error => {

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

@ -1,15 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
export default {
unstable_enableVirtualizedListRemeasureChildrenIfNeeded: (null: ?boolean),
};