NativeScript ListView scroll event

1.8k Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

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