Reputation: 14593
I'm trying to add a listener to scrolling on a Famo.us Scrollview on mobile.
From what I can find, the scrollview's sync emits start
, update
and end
events. But in practice I'm finding that the end
event is fired on touchend
, not when the scrollview actually finishes scrolling given momentum. And update
is fired on touchmove
, again completely ignoring momentum.
How do I listen to actual scrolling?
Upvotes: 0
Views: 158
Reputation: 4595
scrollview._scroller.on('update')
CAN be listened to, but does not guarantee that the values provided are the actual scrolling displacement as the scrollview may decide to scale them.
However, this would allow you to tell whether or not the user is scrolling; combining this with scrollview.getVelocity
you'd have all you'd need.
Upvotes: 0
Reputation: 14353
At version 0.3.1 of Famo.us
there are four events you can use to keep track of some scrolling. Unfortunately, they are limited in what information you can get from them.
They will fire based on the options of your scroll view, so you will need to test. Here is some code to test quickly.
scrollview.on('pageChange', function(event){
console.log('pageChange',event.direction, event.index);
});
scrollview.on('onEdge', function(){
console.log('onEdge');
});
scrollview.on('offEdge', function(){
console.log('offEdge');
});
scrollview.on('settle', function(){
console.log('settle');
});
Upvotes: 2