Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent swiping when first or last page #11

Open
Mokto opened this issue Feb 18, 2016 · 2 comments
Open

Prevent swiping when first or last page #11

Mokto opened this issue Feb 18, 2016 · 2 comments

Comments

@Mokto
Copy link

Mokto commented Feb 18, 2016

Hi,

It would be nice that we could prevent the user to swipe right on the last page and left on the first page.

Thanks.

@skleest
Copy link

skleest commented Mar 7, 2016

+1 :)

@ybonnetain
Copy link

ybonnetain commented Feb 1, 2017

In componentWillMount it is possible to add those extra tests

if (relativeGestureDistance < -0.25 || (relativeGestureDistance < 0 && vx <= -0.25)) {
        if (this.state.index < this.props.children.length - 1) { // make sure it is not the last page before incrementing
          newIndex += 1;
        }
} else if (relativeGestureDistance > 0.25 || (relativeGestureDistance > 0 && vx >= 0.25)) {
      if (this.state.index > 0) { // make sure it is not the first page before decrementing
          newIndex -= 1;
      }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants