Interactive keyboard on iOS with offset ๐ฅ
Say hello to the first release of the year for react-native-keyboard-controller
version 1.16.0
! ๐
This update is packed with new features, critical bug fixes, crash resolutions, and performance optimizations. Letโs dive in and explore whatโs new! ๐
KeyboardGestureArea
with offset
on iOS ๐ฅโ
The cherry on the cake of this release is making KeyboardGestureArea
available on iOS ๐
Previously, react-native developers relied on InputAccessoryView
to extend the keyboard area, but it had several limitations:
- Multiline
TextInput
fields couldn't expand dynamically; - Conditional positioning and padding weren't fully customizable;
- Weird animations when screen gets mounted.
These issues made InputAccessoryView
challenging to use in real-world apps. ๐ญ
Starting with this release, KeyboardGestureArea
is now available on iOS! Currently, it supports the offset
property, but I plan to add more features soon. ๐
useFocusedInput
improvementsโ
More Accurate Selection Eventsโ
Improved precisionโ
Previously, onSelectionChange
events could produce imprecise coordinates, especially when using different paddingTop
/paddingBottom
values or the textAlignVertical
property.
This update fixes those inaccuracies, ensuring more precise coordinates and eliminating the need for workarounds to align positioning between Android and iOS.
Fully compatible with iOS < 13โ
onSelectionChange
didnโt work for single-line TextInput
s on iOS versions below 13. This issue has now been resolved, ensuring compatibility across all iOS versions.
Works Seamlessly with Stripe Inputs on Androidโ
Previously, some third-party SDKs, like Stripe, used custom EditText
subclasses that caused issues when casting to ReactEditText
, preventing the library from recognizing focused inputs.
Iโve reworked the code to interact directly with EditText
whenever possible, ensuring full compatibility with Stripe and other third-party SDKs.
No crashes on iOSโ
While rare, some users experienced crashes due to incorrect Key-Value Observing (KVO) removal when attempting to remove KVO from a view that doesnโt have it.
This release introduces a block-based KVO handling approach, eliminating those crashes.
More Robust Focus Detection (Even When the Keyboard Is Hidden)โ
Previously, the library relied on the keyboardWillShow
event as an indicator that an input field was focused. However, this event doesnโt always triggerโsuch as when using a physical keyboard or setting showSoftInputOnFocus={false}
.
Now, focus detection has been improved to work reliably even without keyboard events.
New preserveEdgeToEdge
prop for KeyboardProvider
โ
Thanks to Mathieu Acthernoene, preserveEdgeToEdge
has been introduced! This property lets you control whether edge-to-edge
mode is disabled when calling setEnabled(false)
, or if you want to keep it enabled.
With edge-to-edge
mode becoming the standard, this option helps prevent conflicts with other libraries.
Improved animation performanceโ
While most users wonโt notice a difference (since before animations were already computed in under 1ms
), Iโve made further optimizations to improve performance.
Even small performance gains are valuable, as they free up CPU resources for other intensive tasks โ such as ShadowTree
traversal in react-native-reanimated
.
What's next?โ
As always, my immediate priority is addressing open issues. Additionally, I have plans for upcoming updates:
- Adding support for
react-native@0.77
; - A major rewrite of
KeyboardAwareScrollView
to consider cursor positioning (this release lays the groundwork by improving event precision to minimize breaking changes in the future).
Stay tuned and follow me on Twitter and GitHub for updates. Thank you for your support! ๐