diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index b72eafbf0def3b..76f1ca2d234593 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -656,18 +656,6 @@ class FlatList extends React.PureComponent, void> { }; }; - _getAccessibilityCollection = () => { - const accessibilityCollectionProps = { - itemCount: this.props.data ? this.props.data.length : 0, - //$FlowFixMe[incompatible-call] see https://bit.ly/3MJiZLL - rowCount: this._getItemCount(this.props.data), - columnCount: numColumnsOrDefault(this.props.numColumns), - hierarchical: false, - }; - - return accessibilityCollectionProps; - }; - render(): React.Node { const { numColumns, @@ -682,7 +670,7 @@ class FlatList extends React.PureComponent, void> { getItem={this._getItem} getItemCount={this._getItemCount} keyExtractor={this._keyExtractor} - accessibilityCollection={this._getAccessibilityCollection()} + numColumns={numColumnsOrDefault(this.props.numColumns)} accessibilityRole={Platform.select({ android: numColumnsOrDefault(this.props.numColumns) > 1 ? 'grid' : 'list', diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 2d491d4a6c79b4..af5580ca802573 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -1233,6 +1233,17 @@ class VirtualizedList extends React.PureComponent { ); } + _getAccessibilityCollection = () => { + const accessibilityCollectionProps = { + itemCount: this.props.data ? this.props.data.length : 0, + rowCount: this.props.getItemCount(this.props.data), + columnCount: this.props.numColumns, + hierarchical: false, + }; + + return accessibilityCollectionProps; + }; + _defaultRenderScrollComponent = props => { const onRefresh = props.onRefresh; if (this._isNestedWithSameOrientation()) { @@ -1249,6 +1260,7 @@ class VirtualizedList extends React.PureComponent { // $FlowFixMe[prop-missing] Invalid prop usage