Skip to content

chore: better sticky view keyboard interpolation#397

Open
arekkubaczkowski wants to merge 1 commit into
kirillzyusko:mainfrom
arekkubaczkowski:feat/better-sticky-interpolation
Open

chore: better sticky view keyboard interpolation#397
arekkubaczkowski wants to merge 1 commit into
kirillzyusko:mainfrom
arekkubaczkowski:feat/better-sticky-interpolation

Conversation

@arekkubaczkowski

@arekkubaczkowski arekkubaczkowski commented Mar 21, 2024

Copy link
Copy Markdown

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

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