-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Unexplained scrolling and flickering on Huawei devices #476
Comments
@nangongmoyan aha, very interesting! Do you have any ideas on how to reproduce this problem without real Huawei/HarmonyOS? Maybe Huawei gives an access to their own device farm? Can you try to comment out this code react-native-keyboard-controller/src/components/KeyboardAwareScrollView/index.tsx Lines 198 to 211 in 02c842d
|
I tried to comment out the code as you suggested, but unfortunately the problem still occurred when running it |
Okay, my another suggestion then is that we are calling
If you are saying, that the code above doesn't work and bug is still there, then I can suggest to comment out |
After digging into the code more, I think I found the reason why it happens. When you update a state, then you trigger a re-render. Triggering a re-render will create a new object/handler for react-native-keyboard-controller/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts Line 71 in 817127f
handler (which will be re-created). As a result we'll dispatch two events onMove and onEnd . And onMove handler will call maybeScroll and we'll scroll into a wrong position.
Can you try to use |
onMove:When only the maybeScroll method in onMove is commented out, the input box will shift upwards when input is first made, and will not shift again afterwards, but the input box below will not be pushed up by the keyboard.The screen recording is as follows: useAnimatedReaction: When only the maybeScroll method in useAnimatedReaction is commented, the input box will always shift upwards, and the input box below can also be lifted up normally, but it also always shifts upwards.The screen recording is as follows: useFocusedInputHandler: When only the maybeScroll method in useFocusedInputHandler is commented, the input box will always shift upwards, and the input box below can also be lifted normally, but it also always shifts upwards.The screen recording is as follows: |
@nangongmoyan cool, that means that the problem is definitely in |
I tried it and it worked, but after switching to deps, this area turned red. It seems that it is not recommended for me to use it this way. |
@nangongmoyan yes, because of types mismatches between REA and I fixed it in my PR - I'll merge it today, but I can not say when I'll prepare a new release (hopefully on this week, but can not promise). In a meantime you can patch it using |
Describe the bug
In the Huawei device where I recorded the screen, I can see that when the input box is being input or deleted, the content on the screen keeps moving upwards, and the input box will flash continuously when continuing to input or delete when it exceeds the screen.
Code snippet
I made the following changes directly on the AwareScrollView in your example, adding the value and onChangeText of the TextInput
To Reproduce
Steps to reproduce the behavior:
It seems that the two input boxes at the top do not have this problem. The triggering point of this problem is that there are too many input boxes on the page, which exceeds the height of the machine. You can try the code I posted and debug it on the corresponding model.
Expected behavior
I want the keyboard to push the input box up normally, but not move or flicker when I enter or delete.
Screen Recording
The following screen recording shows the effect on a real device after I adjusted the code in your example. I didn't make too many adjustments, just added value and onChangeText. I guess it was onChangeText that caused the internal processing problem in your library.
SVID_20240619_145239_1.mp4
Smartphone (please complete the following information):
![Screenshot_20240619_151211_com android settings](https://private-user-images.githubusercontent.com/48037565/340963715-1fa3c2cc-706f-4d2c-b2d3-d8d3542f961a.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExMDI5MTAsIm5iZiI6MTcyMTEwMjYxMCwicGF0aCI6Ii80ODAzNzU2NS8zNDA5NjM3MTUtMWZhM2MyY2MtNzA2Zi00ZDJjLWIyZDMtZDhkMzU0MmY5NjFhLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE2VDA0MDMzMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkwZjI3Y2E5Mzg5MWMyOWEwODc5ODFlZjZmNDc5ZDY5YTJiMjk1NzRjMzBjYjFlYjY2NmJhOTgxMDQxZTVmYmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.6tFuvIjvGxMovbnmPPbHYS3xugPww2K5MapHuOj9QZs)
Additional context
At present, I have only reproduced this problem on this model. The same code does not appear on Xiaomi, Samsung and other devices.
The text was updated successfully, but these errors were encountered: