Skip to content

Commit

Permalink
Add a check for scrollEnabled to VirtualizedList error (#34560)
Browse files Browse the repository at this point in the history
Summary:
Nested `VirtualizedList` is now an [error](646605b), instead of a warning. Issues [here](#31697) and [here](#33024) outline the concern.

## Changelog

[General] [Added] - Added a check to if `scrollEnabled` is not false, if so then fire the `VirtualizedList` error

Pull Request resolved: #34560

Test Plan: Passes all provided automatic tests. In a personal app, there is a situation of nested ScrollViews that had triggered the error. After defining `scrollEnabled={false}` and adding the check, the error no longer appears.

Reviewed By: yungsters

Differential Revision: D39283866

Pulled By: NickGerleman

fbshipit-source-id: 16ae6bbe6bb8b01a54ae18f9e6abf75d11c21c29
  • Loading branch information
Anne Pham authored and facebook-github-bot committed Sep 8, 2022
1 parent 0ef7705 commit 62f83a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Libraries/Lists/VirtualizedList_EXPERIMENTAL.js
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,8 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
!scrollContext.horizontal ===
!horizontalOrDefault(this.props.horizontal) &&
!this._hasWarned.nesting &&
this.context == null
this.context == null &&
this.props.scrollEnabled !== false
) {
// TODO (T46547044): use React.warn once 16.9 is sync'd: https://github.com/facebook/react/pull/15170
console.error(
Expand Down

0 comments on commit 62f83a9

Please sign in to comment.