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

Animated keyboard events #1432

Closed
hosseinmd opened this issue Nov 12, 2020 · 5 comments
Closed

Animated keyboard events #1432

hosseinmd opened this issue Nov 12, 2020 · 5 comments

Comments

@hosseinmd
Copy link
Contributor

Description

A few months ago I made a PR to hooks repo, but after discussing we found that we need something native for the keyboard events
react-native-community/hooks#205
I imagine something like a shared value that subscribed as a keyboard event on the native side. or a hook is like useAnimatedStyle.

Caveats

Motivation

Code example

@jakub-gonet
Copy link
Member

I don't really understand how you want to use shared values to handle keyboard events. Could you describe your use case more clearly and fill all template sections?

@hosseinmd
Copy link
Contributor Author

something like gesture handler events for example

const anim = useSharedValue(0)
useAnimatedKeyboard({
  didShow(event){
     anim.value = withTiming(event.height)
  }
  didHide(_){
     anim.value = withTiming(0)
  }
})

@jakub-gonet
Copy link
Member

I'll discuss this feature internally with the team but I'm not convinced about this feature. We want to focus on animations and listening to keyboard events isn't directly related to that.

@jakub-gonet
Copy link
Member

There are a few problems with that.

First, we currently don't have any way to listen to non-direct events (that aren't connected to Views, keyboard event is a non-direct event). This feature is more related to generic event listening and not animations so we won't include it in this form in Reanimated.

We may consider adding this as a part of some other API in the future but for now, we don't want to make API more complex than it is today.

@jfrolich
Copy link
Contributor

jfrolich commented Mar 8, 2021

It would be great if we can animate with the keyboard. Currently, the only way to do that is to animated by ourselves, but the animation timing and curve are slightly different than the keyboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants