-
Notifications
You must be signed in to change notification settings - Fork 24.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
No fling/momentum on scroll (Android Pie 9.0) #22925
Comments
+1 using: react-native 0.54.0 |
I tried different ROM Resurrection Remix today. It has the same issue with fling. |
I tried react-native 0.58.4 today still same issue. I will try to dig into react native code this Saturday to get the idea |
@alexandrius thank you for digging into this |
I have some updates regarding this issue.
Everything seemed to start working after this change except https://github.com/wix/react-native-calendars. I couldn't expend calendar of Agenda component. Since the behaviour resembles the behaviour of ScrollView inside ScrollView on native Android. I went ahead and extended
Everything started to work just fine after this. |
@patrickkempff Do you suggest creating my own react-native aar package or do you think #23490 can be implemented in short time? |
See my reply on the PR. |
OK thanks. But please I see no reason to close this issue. I will try to fix the code without switching to NestedScrollView |
OK this issue is much bigger than I thought. I think it's something related to javascript engine of AOSP roms. I'll try to dig deeper for this issue |
0.59.0 rc2 has same issue. |
What is the solution to this problem? @cpojer I can dot find your RP can you support in this ,thanks a lot. |
We had a problem with bad scrolling performance on Android 9. In our case we hade a Swiper component that rendered a couple of screens ~6-7 each screen rendered a ActivityIndicator. Removing the extra ActivityIndicator solved the problem for us. |
@cpojer @patrickkempff Can you please give me a tip why might this happening? I just need some information where should I be digging at. Besides swapping ScrollView to NestedScrollView. I tried to comment out some ReactActivity lifecycle methods but the issue is still there. I have only one idea why this might be happening: When the view is overlapped by another view or window the fling behavior stops working. |
OK just after writing the comment above I managed to finally fix this issue. It's far from creating PR but here's some insight:
Here are logs before loosing focus (using the same App.js code I posted when I originally opened the issue). Hash codes are the same
And after loosing code
As you can see the hash codes are different. (@5b3023c vs @f9abd9d) After I add this code the issue is resolved.
I will try to test native Android app with custom OverScroller fling if the issue is there too. This is probably Android issue not React Native |
For anyone experiencing the issue I suggest applying this patch. I understand this is a hacky way of fix so I'm not going to create a PR.
|
Summary: React Native Environment Info: System: OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver) CPU: (4) x64 Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz Memory: 1.12 GB / 15.55 GB Shell: 4.4.19 - /bin/bash Binaries: Node: 8.10.0 - /usr/bin/node Yarn: 1.13.0 - /usr/local/bin/yarn npm: 3.5.2 - /usr/bin/npm SDKs: Android SDK: API Levels: 16, 19, 22, 23, 24, 25, 26, 27, 28 Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.3, 27.0.3, 28.0.2, 28.0.3 System Images: android-16 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom npmPackages: react: 16.8.6 => 16.8.6 react-native: git+https://github.com/facebook/react-native.git#v0.59.5 => 0.59.5 npmGlobalPackages: react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7 The workaround implemented in #21117 tries to fix https://issuetracker.google.com/issues/112385925 scroll direction (according to the latest comments, the scroll direction problem has been reverted in security patches so not sure if the workaround is still valid). But... proposed solution in fling method is using signum which leads to zero computedVelocityY in case of zero mOnScrollDispatchHelper.getYFlingVelocity() on old devices(Samsung s4 mini) even when real velocityY is non zero ``` final int correctedVelocityY = (int)(Math.abs(velocityY) * Math.signum(mOnScrollDispatchHelper.getYFlingVelocity())); ``` Proposed solution is to take signum from original velocityY in case of zero ``` float signum = Math.signum(mOnScrollDispatchHelper.getYFlingVelocity()); if (signum == 0) { signum = Math.signum(velocityY); } final int correctedVelocityY = (int)(Math.abs(velocityY) * signum); ``` The symptoms are the same as described in issue #22925, but proposed workaround doesn't work. [Android][fixed] - Fix smooth scrolling on old devices (SDK >=16) Pull Request resolved: #24545 Differential Revision: D15044834 Pulled By: cpojer fbshipit-source-id: 3f523eb1a438df774e22387aecded433b9031ab9
I can't reproduce that bug on Android 9, even on Expo with https://snack.expo.io/@alexandrius/c3VwcG. Could anyone provide more information on how to replicate this? |
I'm encountering this bug, I upgraded to the latest react native (0.64) hoping it was fixed but nope, I can't replicate it on emulator but on a real device (nexus on android 9 aosp) its easy to replicate, just navigate from a screen that has a flatlist to another and go back or trigger an alert on that same screen, scrolling its like if you set the decelerationRate to 0 |
@charpeni It's only happening on AOSP android roms. |
Environment
Description
I installed custom rom PixelExperience on my Xiaomi Redmi 5 Plus.
Since then I'm experiencing scroll issue. If you make the page lose focus - scroll lacks the fling or momentum behaviour.
This only happens in React Native apps.
Live demo.
https://www.youtube.com/watch?v=vG2fTEb_ICg
Emulator works just fine.
I don't think is the custom rom issue since another user (@vforvasile) has reported the same.
Android has some changes for scrolling element https://developer.android.com/about/versions/pie/android-9.0-changes-28#scrolling-element
I tried using SDK 26 and 27 but it didn't solve the issue
Reproducible Demo
The issue described above is present in expo too.
https://snack.expo.io/@alexandrius/c3VwcG
The text was updated successfully, but these errors were encountered: