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

Wrong index in onSnapToItem when pass data with less or equal than 2 item #170

Closed
hminhman opened this issue Apr 20, 2022 · 3 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@hminhman
Copy link

hminhman commented Apr 20, 2022

Describe the bug
When pass data with less than or equal 2 items (for ex: ['item 0', 'item 1'], ['item 0'] ). In case 1 item, onSnapToItem return index 0 1 2. In case 2 items it return 0 1 2 3. In case > 2 items, it work perfectly. I guess if data not enough 3 item, you add 2 item outside for loop scroll purpose. If true, could you find another way to complete loop logic or re-calculate index in specific case because index is very important to me.

To Reproduce
Pass data with less or equal than 2 item and log index in onSnapToItem

Expected behavior
return true index

Screenshots
image
image

Versions (please complete the following information):

  • react: v17.0.2
  • react-native: v0.67.2
  • react-native-reanimated: v2.4.1
  • react-native-reanimated-carousel: v2.3.4
  • react-native-gesture-handler: v2.2.0

Smartphone (please complete the following information):

  • Device: simulator iPhone 12
  • OS: iOS 14.5

Thank you.

@hminhman hminhman added the bug Something isn't working label Apr 20, 2022
@hminhman hminhman changed the title Wrong index in onSnapToItem when pass data with less than 2 item Wrong index in onSnapToItem when pass data with less or equal than 2 item Apr 20, 2022
@dohooo
Copy link
Owner

dohooo commented May 1, 2022

Yeah.. That's because
image

Now, U can set autoFillData props to false, It will disable this feature. Thanks for your feedback.

It fixed in the latest version.

dohooo added a commit that referenced this issue May 1, 2022
@dohooo dohooo closed this as completed May 2, 2022
@hminhman
Copy link
Author

hminhman commented May 4, 2022

Thanks for your solution, but after upgrade to version 2.3.9 I face this error. Could you give me a hand to solve this problem. Thank you very much.
Simulator Screen Shot - iPhone 12 - 2022-05-04 at 17 14 51

@dohooo
Copy link
Owner

dohooo commented May 4, 2022

Follow to #159

@dohooo dohooo reopened this May 4, 2022
@dohooo dohooo closed this as completed May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants