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

PAN Gesture Causes Lag During Movement on New Architecture on Android #3329

Closed
petrikjan opened this issue Jan 12, 2025 · 2 comments
Closed
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snack or repo is provided

Comments

@petrikjan
Copy link

petrikjan commented Jan 12, 2025

Description

Consider a scroll implemented using Gesture Handler and Reanimated. When performing a PAN gesture (moving a finger across the display) in combination with useAnimatedStyle and transform.translateY, the movement of the element experiences significant lag if some expensive renders are happening in the component. This is likely a bug because, when using withDecay and the finger is no longer on the display, the animation is completely smooth. This issue occurs only on Android with the New Architecture both on the simulator and a real device, in both production and debug builds.

Finger scroll:

Zaznam.obrazovky.2025-01-12.v.3.30.48-1.mov

withDecay scroll:

Zaznam.obrazovky.2025-01-12.v.3.31.52-1.mov

Steps to reproduce

Try scrolling with decay – smooth animation after lifting the finger.
Try scrolling with the finger on the display without using decay – noticeable lag.

Snack or a link to a repository

https://github.com/petrikjan/pan-bug

Gesture Handler version

2.22.0

React Native version

0.76.6

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Repro provided A reproduction with a snack or repo is provided Platform: Android This issue is specific to Android labels Jan 12, 2025
@m-bert
Copy link
Contributor

m-bert commented Jan 21, 2025

Hi @petrikjan! Thanks for reporting this issue. It looks like a problem caused by Reanimated, not Gesture Handler itself. Also, after my tests I can say that withDecay is not perfectly smooth. We talked about it with @bartlomiejbloniarz who currently investigates Reanimated's performance. Our guess is that problem lies in frequent, heavy re-renders (in that repro setState is called every 300ms).

@m-bert m-bert closed this as not planned Won't fix, can't repro, duplicate, stale Jan 21, 2025
@petrikjan
Copy link
Author

Hi, thank you very much for the verification. I will create the same issue on Reanimated. Frequent re-renders are for easier problem identification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

No branches or pull requests

2 participants