n4kz / react-native-pages

Easy to use page view component
Other
376 stars 83 forks source link

How to use isDragging? #34

Closed jgutierrez11 closed 4 years ago

jgutierrez11 commented 5 years ago

I cannot find the way to implement this function, I need to detect if the user is dragging the pager

n4kz commented 4 years ago

Thanks for question and sorry for delayed reply. You can call isDragging() on a reference to Pages component. Please consider the following code:


pagesRef = React.createRef();

onSomeEvent() {
  if (this.pagesRef.current.isDragging()) {
    /* do something */
  }
}

render() {
  return (
    <Pages ref={this.pagesRef} />
  );
}