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

Button position returns an incorrect position #77

Open
DanNeenan opened this issue Nov 29, 2018 · 1 comment
Open

Button position returns an incorrect position #77

DanNeenan opened this issue Nov 29, 2018 · 1 comment

Comments

@DanNeenan
Copy link

When using the package before we were generally using an array of images with length less than 5.

But since we start to use more images we found that the position count would not increase when the next image was scrolled too, but would continue again after that. So far we've seen this at position 6 and 17 and I am pretty stumped as too why.
We aren't calculating anything to do with the position on our end and looking through some of the code I can't see as to why it would stop at certain steps.
Any help would be greatly appreciated.

@DanNeenan DanNeenan changed the title Custom button position returns an incorrect position Button position returns an incorrect position Nov 29, 2018
@DanNeenan
Copy link
Author

Turns out the issue was being caused by adjusting the image width with the padding that we need to get the images to sit properly in the slideshow.
The images loop through correctly when doing it manually, but with the extra padding, the position is being returned incorrectly.
If auto play is set and loops through the images that way, it now ignores the padding and we get the same issue as many other users have had, but the position is returned correctly.

I believe the issue is being cause on line 151

    if (position !== -1 && position !== images.length) {
      newPosition = Math.round(event.nativeEvent.contentOffset.x / width);
      this.setState({ position: newPosition });
    }

I believe the _getPosition() functions returns it correctly from it's position in the array, why is it then being updated by where it is on the screen?

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

No branches or pull requests

1 participant