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

refactor: using requestAnimationFrame instead of setTimeout to reduce frame skipping #536

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

levanthuanmy
Copy link

@levanthuanmy levanthuanmy commented Jan 25, 2024

Hi folks,

I'm currently utilizing this fantastic library but encountering frame rate drops. When using a parallax carousel with autoPlay, the FPS tends to drop during the transition of each slide. This results in a non-smooth scroll, especially when the carousel is embedded within a ScrollView or a complex layout with numerous images.

After some research, I found that switching to requestAnimationFrame to handle autoplay in the useAutoPlay hook could help reduce frame skipping. Here's a demo showcasing the changes:

Test info:

simulator: Pixel 6 Pro API 34
  • Before:
before.mov

Copy link

changeset-bot bot commented Jan 25, 2024

⚠️ No Changeset found

Latest commit: de5bca3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-reanimated-carousel ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 25, 2024 10:55am

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant