Norserium / react-indiana-drag-scroll

React component which implements scrolling via holding the mouse button or touch

Home Page:https://norserium.github.io/react-indiana-drag-scroll/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Supress element.scrollTo(...) events

FBNitro opened this issue · comments

Looking at the README:

onScroll | Function | Invoked when user scrolling container |  
onEndScroll | Function | Invoked when user ends scrolling container |  
onStartScroll | Function | Invoked when user starts scrolling container |

But when I set the initial scroll using the domNode.scrollTo(...); the start/end scroll callbacks are invoked.

Is there any way we can supress this easily?

I've attempted to do this within my app with isInitialized flags etc, but it's quite unreliable. I believe since you know if the user touched/moused etc, this may be easier to handle in the component.

Thanks.

Hello, @FBNitro! I will investigate how to solve this problem. There are no means to distinguish user and programmatic interactions now.

@FBNitro the experimental feature that allows to distinguish appeared in 2.0.0:

onScroll(event) {
    if (event.external) {
       console.log('This events comes outside the scroll container').
    } else {
       console.log('This event produces by user interaction with the scroll container')
    }
}