kirillzyusko / react-native-keyboard-controller

Keyboard manager which works in identical way on both iOS and Android
https://kirillzyusko.github.io/react-native-keyboard-controller/
MIT License
1.54k stars 61 forks source link

Weird Scroll when change text event fires on android 9 and 10 #384

Closed taha200 closed 2 months ago

taha200 commented 5 months ago

I started to use this library because it has great feature to avail and maintain time to time, I encountered the issue that I am experiencing the weird scroll whenever I write a text in my text input and it is happening on the android OS 9 and 10

` <KeyboardAwareScrollView contentContainerStyle={{ flexGrow: 1, backgroundColor: 'white' }} keyboardShouldPersistTaps={Platform.OS === 'ios' ? 'never' : 'always'} bounces={false}

`

Video Link: https://wetransfer.com/downloads/2143ff1a64e1667cdb40042ba656fd4a20240312101324/dbc0bc

kirillzyusko commented 5 months ago

Hey @taha200

Can you provide more information please, especially:

Most likely problem happens here - https://github.com/kirillzyusko/react-native-keyboard-controller/blob/main/src/components/KeyboardAwareScrollView/index.tsx#L197

You can try to comment out this line and see how it behaves. However for me it looks like there is a problem with memoization and it reads old layout from TextInput 👀

taha200 commented 5 months ago
  1. Samsung Galaxy A01
  2. library version 1.10.2
  3. Just fire a text event and this issue is happening https://wetransfer.com/downloads/2143ff1a64e1667cdb40042ba656fd4a20240312101324/dbc0bc I paste the link here for demo
  4. yes
  5. no
taha200 commented 5 months ago

I commented out the line and nothing happens, issue still persists. @kirillzyusko

kirillzyusko commented 5 months ago

@taha200 I can not reproduce this problem in example app (I've tested app on Pixel 6 Pro, API 28):

https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/5a570ba4-70e1-477b-95a3-dc3389ae6f10

Can you provide a minimal reproduction example, please?

taha200 commented 5 months ago

Let me know the library version please?

taha200 commented 5 months ago

I checked the same simulator and not getting this issue, but can you check on the physical device?

kirillzyusko commented 5 months ago

Let me know the library version please?

This is example app from main branch (version 1.11.3).

I checked the same simulator and not getting this issue, but can you check on the physical device?

I tested on a physical Xiaomi Redmi Note 5 Pro (Android 9) and Pixel 7 Pro (Android 14) and the issue is not reproducible. You've said it's reproducible on emulator - can you give me your emulator configuration?

taha200 commented 5 months ago

I think I should upgrade the library version, I will check it and let you know My bad I had mistakenly wrote yes for the emulator.

taha200 commented 5 months ago

This issue is still persist in new version, can you help me out please?

taha200 commented 5 months ago

I think the onchangetext with usememo as you stated earlier is making the problems, I am getting the problem in 9 and 10 all devices. @kirillzyusko

taha200 commented 5 months ago

I used text input from react native paper

kirillzyusko commented 5 months ago

@taha200 I'd like to help you, but without a proper reproduction example I can't. Please, provide minimal reproduction example and ideally the problem should be reproducible in environment that we both can have (i. e. Android Studio/Genymotion emulator - I can try to run example in device farm, but minimal available version there is Android 11).

You can also try to debug this problem yourself. Two suspicious things are:

If you want to debug, then first of all I'd recommend you to understand which code calls maybeScroll function when you are typing. And when you'll have this information we can proceed with a potential fix (i. e. at least we'll know on which level it should be fixed - native or JS code).

P. S. do you use react-native-avoid-softinput? I remember it could produce some conflicts and cause unnecessary scrolling.

kirillzyusko commented 5 months ago

Posting for better visibility - tried to find Samsung A01 on AWS device farm but didn't find it there 😔

@taha200 do you use Samsung A10 or Samsung A01?