Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: better sticky view keyboard interpolation #397

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arekkubaczkowski
Copy link

@arekkubaczkowski arekkubaczkowski commented Mar 21, 2024

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

after.mov
before.mov

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

@kirillzyusko kirillzyusko self-assigned this Mar 21, 2024
@kirillzyusko kirillzyusko added the 📚 components Anything related to the exported components of this library label Mar 21, 2024
@kirillzyusko
Copy link
Owner

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
Copy link
Author

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

@kirillzyusko kirillzyusko added the KeyboardStickyView 🩹 Anything related to KeyboardStickyView component label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 components Anything related to the exported components of this library KeyboardStickyView 🩹 Anything related to KeyboardStickyView component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants