Search code examples
iosnativescriptnativescript-angularios11.4

NativeScript ListView scroll event


How can I detect when a ListView is scrolled?

I tried wrapping the ListView in a ScrollView and using the scroll event on the ScrollView. Doesn't work.


Solution

  • I've used the PanGesture on a ListView to capture when a user is scrolling up or down.

      const panEvent$ = fromEvent(this.listView, 'pan').pipe(map(
        (event: PanGestureEventData) => event.deltaY
      ));
    

    This will take my listView property and only emit the Y values. you can then determine if they are moving up or down if Y is greater than 0