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.59k stars 64 forks source link

Library does not work with inputs that cover entire screen #578

Open nicolaosm opened 2 weeks ago

nicolaosm commented 2 weeks ago

Describe the bug When using a large multi-line text input field, the view does not automatically scroll to the cursor when it is placed somewhere within the text. This issue occurs particularly when the text field is large in height.

Code snippet This issue can be reproduced with any basic text input field that has a height of 900 units or more.

To Reproduce Steps to reproduce the behavior:

  1. Create a TextInput field with a height of 900 units.
  2. Fill the input with enough text to require scrolling.
  3. Place the caret (cursor) at a position within the text that is not currently visible on the screen.

Expected behavior The view should automatically scroll to make the cursor visible whenever it is placed within the text.

Screenshots A video demonstrating the issue:: https://cln.sh/HLlnFNpZ

Smartphone (please complete the following information):

kirillzyusko commented 2 weeks ago

Hey @nicolaosm

Thank you for bringing that issue 😍

I think a similar problem was reported in https://github.com/kirillzyusko/react-native-keyboard-controller/issues/512

Do you expect the cursor to be visible when you set a focus, right? Because the second issue is more about incorrect position during typing πŸ€”

nicolaosm commented 2 weeks ago

Hi @kirillzyusko,

Yes you’re right. In my recorded video there are two issues showing:

  1. When we set focus, the scroll view is not animating to the correct position of the cursor. (Happening in multi line/large text inputs)
  2. When we type on the keyboard, the scroll view is not auto scrolling to the correct position to show us the cursor and where we are typing.

I’m not sure if this issue is actually related to #512 It seems to me to be a different issue.

Thanks @kirillzyusko

kirillzyusko commented 2 weeks ago

@nicolaosm cool, thank you for clarification!

It may be different problems, but in the end all of them will be fixed by utilizing onSelectionChange event (instead of relying on layout of text input).

I'll try to fix it - all native code is in place, I just need to re-work JS part, so it shouldn't be a big challenge πŸ‘€

nicolaosm commented 2 weeks ago

Thats amazing @kirillzyusko! Thank you for your quick and proactive approach. 🀩

GhayoorUlHaq commented 1 week ago

getting same issue as well, waiting for fix @kirillzyusko Thanks πŸ™‚