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

Fix smooth scroll android #4238

Merged
merged 10 commits into from
Mar 30, 2023
Merged

Fix smooth scroll android #4238

merged 10 commits into from
Mar 30, 2023

Conversation

Latropos
Copy link
Contributor

@Latropos Latropos commented Mar 17, 2023

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.

AnimatedNot Animated
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

@piaskowyk
Copy link
Member

To fix CI you need to run: cd android && ./gradlew :spotlessApply

@Latropos Latropos force-pushed the @acynk/fix-smooth-scroll-android branch from 35ab46c to 523b178 Compare March 20, 2023 09:25
@Latropos Latropos force-pushed the @acynk/fix-smooth-scroll-android branch from e917292 to eebe7e1 Compare March 20, 2023 11:08
Copy link
Member

@piaskowyk piaskowyk left a 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?

@Latropos Latropos force-pushed the @acynk/fix-smooth-scroll-android branch from eebe7e1 to f114b35 Compare March 21, 2023 08:40
@Latropos Latropos marked this pull request as ready for review March 21, 2023 08:48
Copy link
Member

@piaskowyk piaskowyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Latropos Latropos force-pushed the @acynk/fix-smooth-scroll-android branch from 8304082 to 7e43304 Compare March 21, 2023 10:54
@Latropos Latropos requested a review from piaskowyk March 21, 2023 10:55
@Latropos Latropos force-pushed the @acynk/fix-smooth-scroll-android branch from 7e43304 to 6f5058e Compare March 21, 2023 11:01
@Latropos Latropos requested a review from piaskowyk March 21, 2023 11:19
} else {
((ReactScrollView) view).scrollTo((int) x, (int) y);
}
(view).scrollTo((int) x, (int) y);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(view).scrollTo((int) x, (int) y);
view.scrollTo(x, y);

@piaskowyk piaskowyk added this pull request to the merge queue Mar 30, 2023
Merged via the queue into main with commit 225073d Mar 30, 2023
@piaskowyk piaskowyk deleted the @acynk/fix-smooth-scroll-android branch March 30, 2023 19:32
fluiddot pushed a commit to wordpress-mobile/react-native-reanimated that referenced this pull request Jun 5, 2023
<!-- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] scrollTo with animated=true does not work scrollTo not working with animated property
3 participants