question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not get the correct current index

See original GitHub issue

Is this a bug report, a feature request, or a question?

Bug report.

Have you followed the required steps before opening a bug report?

(Check the step you’ve followed - replace the space character between the square brackets ([]) by an x.)

Have you made sure that it wasn’t a React Native bug?

It wasn’t React Native bug

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

I reproduce this issue on iOS 12.12

Is the bug reproductible in a production environment (not a debug one)?

Yes

Environment

Environment: React: 16.6.3 React native: 0.57.7 react-native-snap-carousel: 3.7.5

Target Platform: iOS (12.12)

Expected Behavior

Should get the correct current index.

Actual Behavior

Can not get the correct current index when item only leaves one.

Reproducible Demo

https://snack.expo.io/@kwguo/react-native-snap-carousel-currentindex-not-correct Delete any item, and tap “Show current index”, the current index will be wrong.

Steps to Reproduce

  1. Set loop prop are true.
  2. Delete item until one is left.
  3. Get current index from ref, the current index will be wrong.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
daaashleycommented, Jun 25, 2019

@MobDevelop @shana0440 had this issue, setting

enableMomentum={true}

fixed it for me

0reactions
babyrusacommented, Nov 9, 2022

I use onBeforeSnapToItem which is better then onSnapToItem in my case

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix Git error: you need to resolve your current index first
How to fix Git error: you need to resolve your current index first · Make sure all your changes are committed. · Abort...
Read more >
Fix search issues by rebuilding your Instant Search catalog
Identifies locations to be indexed, and locations to be excluded from indexing. On the File tab, choose Options > Search. Under Sources, click...
Read more >
Page Indexing report - Search Console Help - Google Support
See which pages Google can find and index on your site, and learn about any indexing problems encountered. Open Page Indexing report.
Read more >
Java, How do I get current index/key in "for each" loop [duplicate]
This is indeed the correct answer semantically, for each loop can iterate through streaming data from a remote database which is being updated ......
Read more >
Troubleshoot failed rollover index in Amazon OpenSearch ...
I want to use Index State Management (ISM) to roll over my indices on my Amazon OpenSearch Service cluster. However, my index fails...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found