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.38k stars 55 forks source link

When focusing for the first time, the onSelectionChange of useFocusedInputHandler is not called #482

Closed zyslife closed 6 days ago

zyslife commented 1 week ago

Describe the bug "When focusing for the first time, the onSelectionChange of useFocusedInputHandler is not called, but the native onSelectionChange is called. An example that can reproduce this issue: FocusedInputHandlers."

To Reproduce Steps to reproduce the behavior:

1.First, enter 𝑛 characters in the input field. At this point, the cursor is at the end. 2.Make the input field lose focus. 3.Click at the beginning of the input field, causing the cursor to focus on the first character. 4.The onSelectionChange of useFocusedInputHandler will not be called.

Expected behavior My expected behavior: it should be called just like the native onSelectionChange, because this is very important; otherwise, the cursor position will be incorrect.

zyslife commented 1 week ago

That was a fast fix, thumbs up~ I hope it keeps getting better and better.

kirillzyusko commented 1 week ago

Thanks @zyslife ❤️

I'll test code changes again tomorrow and if everything is okay, then will merge them 👀 In a meantime you can use patch-package to fix it in your project 🤞