mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-06 22:37:14 +08:00
Summary: This PR fixes the case where the content a VirtualizedList loads with a contentLength of 0, causing a crash in the `renderDebugOverlay` function. The result of that crash is a red screen when turning on debug on FlatList and other VirtualizedList components as described in #24053. [LIST] [FIX] - Fix VirtualizedList debug mode crash Pull Request resolved: https://github.com/facebook/react-native/pull/24058 Differential Revision: D14538317 Pulled By: cpojer fbshipit-source-id: 7b17bf51c388561c517bab1f775a31200abdc5a9
This commit is contained in:
committed by
Facebook Github Bot
parent
7ae90408c9
commit
02e8e531dd
@@ -1169,7 +1169,8 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
||||
|
||||
_renderDebugOverlay() {
|
||||
const normalize =
|
||||
this._scrollMetrics.visibleLength / this._scrollMetrics.contentLength;
|
||||
this._scrollMetrics.visibleLength /
|
||||
(this._scrollMetrics.contentLength || 1);
|
||||
const framesInLayout = [];
|
||||
const itemCount = this.props.getItemCount(this.props.data);
|
||||
for (let ii = 0; ii < itemCount; ii++) {
|
||||
|
||||
Reference in New Issue
Block a user