1

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.

Chris McKnight
  • 8,540
  • 4
  • 29
  • 31

1 Answers1

2

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

JoshSommer
  • 2,550
  • 18
  • 23