-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix smooth scroll android #4238
Conversation
android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java
Outdated
Show resolved
Hide resolved
android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java
Outdated
Show resolved
Hide resolved
To fix CI you need to run: |
35ab46c
to
523b178
Compare
android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java
Outdated
Show resolved
Hide resolved
android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java
Outdated
Show resolved
Hide resolved
e917292
to
eebe7e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The horizontal
variable seem to be unused. Could we remove it?
android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java
Outdated
Show resolved
Hide resolved
eebe7e1
to
f114b35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8304082
to
7e43304
Compare
android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java
Outdated
Show resolved
Hide resolved
7e43304
to
6f5058e
Compare
} else { | ||
((ReactScrollView) view).scrollTo((int) x, (int) y); | ||
} | ||
(view).scrollTo((int) x, (int) y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(view).scrollTo((int) x, (int) y); | |
view.scrollTo(x, y); |
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary Fix this issue: software-mansion#4200 It looks that smoothScrollTo was not always working on Android. According to this stackOverflow [question](https://stackoverflow.com/questions/18673065/scrollto-always-works-smoothscrollto-only-sometimes) we should post a runnable here. <!-- Explain the motivation for this PR. Include "Fixes #<number>" if applicable. --> ## Test plan <!-- Provide a minimal but complete code snippet that can be used to test out this change along with instructions how to run it and a description of the expected behavior. --> Tested 4 cases in our example App: Horizontal and Vertical Scrolls with both animated and instant transitions. <table> <tr><td>Animated</td><td>Not Animated</td></tr> <tr><td> https://user-images.githubusercontent.com/56199675/226555227-3b75ba0b-2861-47ea-955f-56e8c368ad0f.mov </td><td> https://user-images.githubusercontent.com/56199675/226555278-6c0f329a-4417-4271-a337-bd28b41c28f2.mov </td></tr> <tr><td> https://user-images.githubusercontent.com/56199675/226556289-8b527a54-8f8e-4b4d-9ff5-5ce4e05414d3.mov </td><td> https://user-images.githubusercontent.com/56199675/226556339-2dbe1e56-05e5-4923-8f4d-80050ade8bbe.mov </td></tr> </table> --------- Co-authored-by: Aleksandra Cynk <aleksandracynk@aleksandras-mbp.home> Co-authored-by: Aleksandra Cynk <aleksandracynk@swmansion.com> Co-authored-by: Krzysztof Piaskowy <krzysztof.piaskowy@swmansion.com>
Summary
Fix this issue: #4200
It looks that smoothScrollTo was not always working on Android. According to this stackOverflow question we should post a runnable here.
Test plan
Tested 4 cases in our example App: Horizontal and Vertical Scrolls with both animated and instant transitions.
Screen.Recording.2023-03-21.at.09.41.22.mov
Screen.Recording.2023-03-21.at.09.40.54.mov
Screen.Recording.2023-03-21.at.09.45.54.mov
Screen.Recording.2023-03-21.at.09.46.44.mov