Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What exactly is your solution to "VirtualizedLists should never be nested inside plain ScrollViews with the same orientation" #27945

Closed
CostachescuCristinel opened this issue Feb 4, 2020 · 1 comment
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Type: Question Issues that are actually questions and not bug reports.

Comments

@CostachescuCristinel
Copy link

CostachescuCristinel commented Feb 4, 2020

This annoying warning makes no sense. Nesting any type of scrollable view should be allowed and supported, not forbidden.

I would not post about this warning if it wasn't that my console is constantly flooded with these warnings, and I have to scroll back and forth in the console to actually see my own console.log s.

So, let's assume that we are mistaken, and nesting scrollables is a bad idea, and we should follow your advice as in the warning. What exactly is your solution to be able to manage nested scrollable content, with or without the same orientation?

Consider my use cases:

  • I am using a main View (vertical orientation) with a ScrollView and a KeyboardAvoidingView, in order to resize the actual content area when the virtual keyboard appears on screen. It works flawlessly, on small screens, if the actual content does not fit, the ScrollView will take care of allowing the content to be scrolled while the keyboard eats screen space. When the keyboard is hidden, the ScrollView will just take everything for it.
  • I am using nested ScrollView s to redirect the user to a different part of the application. The behavior is similar to React Navigation and the concept of Screens. I switch the scroll orientation depending on what makes sense for the particular use case, but mostly, it is a main horizontal scroll, with multiple vertical scrolls, all of fixed width/height (usually, as much as SafeAreaView allows). The content in those vertical scrolls may themselves have other scrollable children.
  • I am using a main FlatList (vertical orientation) in order to display a list of items (up to 10 items or so). However, if the item height is larger than the fixed-height items of the main FlatList, the item content will be displayed in another FlatList, with the same orientation, allowing each item to be scrolled by itself. This is a todo list -like app, where multiple lists are displayed on the screen, and each list may or may not have more items than the item height allows. All of this content is, again, put inside a ScrollView for the keyboard area, just like in my first use case presented here.

Can you provide a compelling reason why my use cases would not be valid, and why nesting scrollables is a bad idea?

@CostachescuCristinel CostachescuCristinel added the Type: Question Issues that are actually questions and not bug reports. label Feb 4, 2020
@react-native-bot
Copy link
Collaborator

react-native-bot commented Feb 6, 2020

We are using GitHub issues exclusively to track bugs in React Native. GitHub may not be the ideal place to ask a question, but you can try asking over on Stack Overflow, or on Reactiflux.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Type: Question Issues that are actually questions and not bug reports.
Projects
None yet
Development

No branches or pull requests

2 participants