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

fix: update selection on focus #483

Closed kirillzyusko closed 6 days ago

kirillzyusko commented 1 week ago

📜 Description

Update selection when focused has changed on iOS.

💡 Motivation and Context

That problem was present since the first version when the onSelectionChange handler was available (1.12.0). But I ignored it, since it wasn't so important 🙈

In this PR I'm fixing the problem by manual event dispatching (when we add a delegate, i. e. focus was received). The problem is specific only for iOS (on Android it doesn't exist). But I had a plan to revisit Android implementation and make it more optimal, so keeping it in mind I decided to add e2e test to be sure such important functionality will not be broken in future releases.

Also in this PR I removed unnecessary class/structure instance creation and simplified code a little bit 👀

Closes https://github.com/kirillzyusko/react-native-keyboard-controller/issues/482

📢 Changelog

E2E

iOS

🤔 How Has This Been Tested?

Tested manually on iPhone 15 Pro (iOS 17.5, simulator).

📸 Screenshots (if appropriate):

https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/e81ef947-8667-4acd-bf20-a3a837572317

📝 Checklist

github-actions[bot] commented 1 week ago

📊 Package size report

Current size Target Size Difference
144183 bytes 144245 bytes -62 bytes 📉