Skip to content

Button position returns an incorrect position #77

Description

@DanNeenan

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.

Activity

  1. changed the title [-]Custom button position returns an incorrect position[/-] [+]Button position returns an incorrect position[/+] on Nov 29, 2018
  2. DanNeenan commented on Nov 29, 2018

    @DanNeenan
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions