It appears you cannot use ListView on a page that is wrapped in ScrollView


#1

I have a page this is very long and needs to be wrapped in ScrollView. I would like to use Listview on that page for two lists of data that appear. I cannot seem to get it to work as only the first item appears. If I change to using an Angular *ngFor loop to draw the labels, everything works fine. Is there a setting in ListView that allows for it to coexist inside a ScrollView?


#2

List view can’t be used inside a ScrollView.
Your best bet is to use ngFor, just like you have already mentioned.


#3

ListView itself has a built-in ScrollView and by default fills the screen, but if you set the list to occupy only the space it needs then you can still wrap it inside ScrollView.


#4

@bradrice
Like Manoj said,
If you give the list view a predefined height, then it is possible to have it inside ScrollView.

It should basically be inside another Layout.

<ScrollView>
    <Any of the 5 layouts>
        <other elements>
        </other elements>
        <ListView height="300">
        </ListView>
        <other elements>
        </other elements>
    </Any of the 5 layouts>
</ScrollView>

But at the end of the day, you can’t scroll that ListView unless it scrolls horizontally.

Refer this quick demo to learn more,

link: https://play.nativescript.org/?template=play-js&id=pMyfcc&v=3