Scroll down programmatically


#1

how to scroll down or up scrollview from code?


#2

In your xml/html file, add an id to the scrollview :

<ScrollView #ScrollList>

In your js/ts file, add the scroll view id :

@ViewChild("ScrollList") scrollList:ElementRef;

then you can access scrollToVerticalOffset function like so (n is the integer you want to scroll to) :

this.scrollList.nativeElement.scrollToVerticalOffset(n);

#3

@pacome2017 I don’t think scrollToIndex is a defined method of ScrollView.

Try .scrollToVerticalOffset / .scrollToHorizontalOffset.


#4

you’re right, it is defined for listView, i’ve updated my answer