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: iOS 13 compilation issues #460

Closed kirillzyusko closed 1 month ago

kirillzyusko commented 1 month ago

πŸ“œ Description

Fixed iOS 13 compatibility.

πŸ’‘ Motivation and Context

For projects that are targeting iOS 12.4 (for example react-native 0.72) textFieldDidChangeSelection method doesn't exist for UITextFieldDelegate.

To fix it I added @available annotation that takes the method into compilation only for iOS 13+.

Technically it's not very correct solution, because onSelectionChange will not be fired from my handler on iOS 12 - if we want to have this event we have to capture events from setter and forward it, but without subclassing it's pretty hard to achieve (only method swizzling as a last resort). But I don't want to spend too much time right now - if I get request that this functionality must be implemented for iOS 12, then I'll add it (otherwise I don't see a lot of sense in that right now, because RN already dropped minimal supported version, so I expect more and more people will move away from iOS 12 soon).

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

πŸ“’ Changelog

iOS

πŸ€” How Has This Been Tested?

Tested on CI.

πŸ“ Checklist

github-actions[bot] commented 1 month ago

πŸ“Š Package size report

Current size Target Size Difference
136525 bytes 136510 bytes 15 bytes πŸ“ˆ