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 has no animation inside Android Emulator #573

Open
bozha-step opened this issue Mar 21, 2024 · 1 comment
Open

Carousel has no animation inside Android Emulator #573

bozha-step opened this issue Mar 21, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@bozha-step
Copy link

Describe the bug
A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks!

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
I have a Carousel component which works well on iOS, but there is no scroll animation (like scrollAnimationDuration 0) when it's on Android Emulator. Haven't tested on a real Android device yet.

Versions (please complete the following information):

  • react-native: v0.73.2
  • react-native-reanimated: v3.6.1
  • react-native-reanimated-carousel: v3.5.1
  • react-native-gesture-handler: v2.14.0

Smartphone (please complete the following information):

  • Device: [Android Pixel 4 API 34 Emulator]

Additional context
The onSnapToItem also returns wrong index, which has no pattern.

@bozha-step bozha-step added the bug Something isn't working label Mar 21, 2024
Copy link

dosubot bot commented Mar 21, 2024

Hey there, @bozha-step! Fancy seeing you here again. Let's dive into this carousel conundrum 🎢

Thank you for providing detailed information about the issue you're experiencing. Based on the information you've provided and the similar issues I found in the react-native-reanimated-carousel repository, it seems that the lack of scroll animation and incorrect index returned by onSnapToItem on Android Emulator are known issues.

For the lack of scroll animation, there are a few similar issues reported in the repository, such as scrollTo, next, prev animation problem and the carousel is un working. One of the suggested solutions is to ensure that the app is running without the debugger.

For the incorrect index returned by onSnapToItem, it might be due to how the index is calculated in the _onScrollEnd method. The calculation uses getSharedIndex, which is then adjusted by computedRealIndexWithAutoFillData. If this calculation does not account for platform-specific behaviors or rounding issues, it might lead to incorrect indices on Android.

As a starting point for debugging, you could try logging the values of _sharedIndex and realIndex in _onScrollEnd to see if there's a noticeable difference in how they're calculated between iOS and Android. This might help identify if the issue is with the calculation itself or how scroll/gesture events are reported.

In terms of the scroll animation, you could start by isolating whether the issue lies with gesture handling or the animation triggering mechanism. You can add logging or breakpoints to see if the expected animation-related code paths are executed on Android.

Please note that these are just potential leads and the actual issue might be different based on the specific implementation details of your app and the Carousel component. If you need further assistance, please provide more details about your implementation, especially the parts related to the Carousel component and its configuration.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

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