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

Carousel locks onto index 0 even when current index is non-zero #39

Open
with-a-k opened this issue Jul 16, 2018 · 3 comments
Open

Carousel locks onto index 0 even when current index is non-zero #39

with-a-k opened this issue Jul 16, 2018 · 3 comments

Comments

@with-a-k
Copy link

I have a sideswipe view that contains a data array that the user can add and remove items to. However, when I try sliding the view to another item in the array, the carousel locks itself to the item with index 0, even though the container's currentIndex state and the matching prop on the items themselves are some other index.

envinfo results:
System:
OS: Linux 4.4 Ubuntu 16.04.3 LTS (Xenial Xerus)
CPU: x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Memory: 5.82 GB / 15.89 GB
Shell: 4.3.48 - /bin/bash
Binaries:
Node: 8.9.1 - /usr/bin/node
npm: 6.2.0 - /usr/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
Utilities:
Make: 4.1 - /usr/bin/make
GCC: 5.4.0 - /usr/bin/gcc
Git: 2.7.4 - /usr/bin/git
IDEs:
Nano: 2.5.3 - /bin/nano
Vim: 7.4 - /usr/bin/vim
Languages:
Bash: 4.3.48 - /bin/bash
Java: 1.8.0 - /usr/bin/javac
Perl: 5.22.1 - /usr/bin/perl
Python: 2.7.12 - /usr/bin/python
Ruby: 2.2.7 - /usr/share/rvm/rubies/ruby-2.2.7/bin/ruby
Databases:
SQLite: 3.11.0 - /usr/bin/sqlite3
Browsers:
Chrome: 62.0.3202.94

Please make sure these boxes are checked before submitting your issue!

  • [ X ] envinfo results
  • [ X ] I created a reproduction example here (if bug related)
@GelsonBlaze
Copy link

GelsonBlaze commented Jul 19, 2018

I have the same problem and would like a solution as well. Resetting the currentIndex doesn't work.

Edit: Use an if statement. If currentIndex > 0 u reset it to 0 on item remove or add.

@kkemple
Copy link
Owner

kkemple commented Nov 19, 2018

currentIndex needs to be a prop on the SideSwipe component, not it's children, it is using default currentIndex of 0, move that prop up to sideswipe component and should work!

@nilsbacke-ef
Copy link

Hello, I am still having this issue. I'm using Typescript, and I cannot add the currentIndex prop to the SideSwipe component because it does not exist. The currentIndex prop in the renderItem callback is always returning 0.

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

4 participants