react-native-keyboard-controller
react-native-keyboard-controller copied to clipboard
chore: better sticky view keyboard interpolation
📜 Description
The element rendered within StickyView doesn't follow the keyboard and there appears a gap between. This PR changes the way how sticky element position is being calculated.
💡 Motivation and Context
📢 Changelog
JS
- replace interpolate with clamp method that calculates the exact position followed by keyboard
🤔 How Has This Been Tested?
Tested in the project where this error occurs.
https://github.com/kirillzyusko/react-native-keyboard-controller/assets/18654447/5ed3138c-7eae-45b8-aed0-ecc001b48457
https://github.com/kirillzyusko/react-native-keyboard-controller/assets/18654447/bbae8ca8-844e-4cc8-9946-13b5d00daa15
📝 Checklist
- [ ] CI successfully passed
- [ ] I added new mocks and corresponding unit-tests if library API was changed
Hey @arekkubaczkowski
This code introduces breaking changes which I'd like to avoid:
| Old | New |
|---|---|
If we are using negative offset for closed, then it'll be ignored 😔
Maybe we can add a new property, like ignoreHeightBelow and use interpolation like:
interpolate(height.value, [0, ignoreHeightBelow, height.value], [closed, closed, opened])
Will it work for you?
@kirillzyusko Nice spot, I had to miss that. Yeah, having an option to toggle those two behaviours makes sense for me! will push the changes later on.