Search code examples
mobilescrollreact-nativereact-native-listview

Checking if scroll components are bigger than the screen React Native


I am having a problem with list/scroll views in big screens.

In the application there is a scroll component who queries for more rows when its end is reached. However, when the screen has big enough resolution, the initial query is not enough to generate the scroll bar, and thus, the event is never triggered.

The team agrees that because of the instability of the Dimensions module in React Native, a better solution would involve already implemented abstractions instead of getting the screen's dimension with the mentioned module.

What could be a good solution to the problem? I hope I was clear.

Thanks in advance.


Solution

  • My solution was to query when the 'layout' event was fired. I did this through the 'onLayout' and 'onContentSizeChange' props. They store the heights of the list and the component, which made me able to compare both and query for more data.