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.62k stars 67 forks source link

chore: better sticky view keyboard interpolation #397

Open arekkubaczkowski opened 6 months ago

arekkubaczkowski commented 6 months ago

📜 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

🤔 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

kirillzyusko commented 6 months ago

Hey @arekkubaczkowski

This code introduces breaking changes which I'd like to avoid:

Old New
image image

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?

arekkubaczkowski commented 6 months ago

@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.