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 👀
📜 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
onSelectionChange
when we receive a focus;🤔 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