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

height of useReanimatedKeyboardAnimation is negative #859

Closed
friedolinfoerder opened this issue Mar 14, 2025 · 3 comments
Closed

height of useReanimatedKeyboardAnimation is negative #859

friedolinfoerder opened this issue Mar 14, 2025 · 3 comments
Labels
question You wanted to clarify something about the usage of the library or have a question about something

Comments

@friedolinfoerder
Copy link

The value of the sharedValue height is negative (only in my case!?). Is this intended?

In file src/animated.tsx you set - explicit:

heightSV.value = -event.height;

I see this behavior with android edge-to-edge (react-native-edge-to-edge) and RN 0.76.6.

@kirillzyusko kirillzyusko added the question You wanted to clarify something about the usage of the library or have a question about something label Mar 14, 2025
@kirillzyusko
Copy link
Owner

@friedolinfoerder This is how I initially designed it, so yes, it's intended.

The initial idea was to have syntax like this:

const {height} = useReanimatedKeyboardAnimation();

const style = useAnimatedStyle(() => ({
  transform: [{translateY: height}] // no minus needed
}), [])

However later on I realized, that it's not so convenient when you animate height and other properties 😔

I planned to change that behavior in v2 - but I don't know when I'll release it 🤷‍♂

If you are confused by this fact, then you can return your own hook and return a positive value from there 🙂

I'm going to close this issue, because yes, it's intended, but I see downsides and want to re-work them, but don't know when :)

@friedolinfoerder
Copy link
Author

Wow, really fast response 🚀 thank you 😃

Yes, was confused about it (because with the name height you wouldn't guess).

If you are confused by this fact, then you can return your own hook and return a positive value from there 🙂

I will do this; I already have my own hook wrapper in place – I only was not sure, if it is consistent behavior for both platforms or a bug on my side

Great library btw 👍 – looking forward for further improvements and v2 😉

@kirillzyusko
Copy link
Owner

@friedolinfoerder yes, it's consistent for both platforms 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question You wanted to clarify something about the usage of the library or have a question about something
Projects
None yet
Development

No branches or pull requests

2 participants