You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keyboard height as animated value from useKeyboard #81
I think it would be nice if useKeyboard could return an Animated.value for the keyboard height.
Why it is needed
Currently, when using keyboardHeight to set e.g. padding it looks very janky when the keyboard is shown or hidden. Exporting an animated value that represents the height could allos the end user to animate the padding as the keyboard appears.
Possible implementation
t.b.d
Code sample
t.b.d.
I need this in a project I'm working on so I will probably submit a pull request as soon as I get time ☺️
Reacted by Pavlos Vinieratos, Jérémy M, Nasir Sheikh, Andrei Barabas, Eyal Yoli Abs and Jack Coy
One thing I would suggest is to keep the keyboardHeight we have, and use a new animKeyboardHeight to be the Animated.Value one, so we don't break old stuff, and to allow users to access the height directly, without the need to mess with animated values if they don't care about that.
Reacted by Linus Unnebäck, Petra, Nasir Sheikh, Andrei Barabas and Arno Fortelny
import{useKeyboardEffect}from'@react-native-community/hooks'useKeyboardEffect((type,event)=>{if(type==='keyboardDidShow'){console.log('keyboard did show')}elseif(type==='keyboardDidHide'){console.log('keyboard did hide')}},[])
This way we could work with any animated react-native or react-native-reanimated or something different
Activity
pvinis commentedon Mar 17, 2020
That's a good idea. For playing around, I made this with no animations https://snack.expo.io/Bk6HNSRHU and this with react-spring https://snack.expo.io/HJN9BBRS8.
One thing I would suggest is to keep the
keyboardHeightwe have, and use a newanimKeyboardHeightto be theAnimated.Valueone, so we don't break old stuff, and to allow users to access the height directly, without the need to mess with animated values if they don't care about that.magrinj commentedon Apr 9, 2020
Hello guys ! I've juste made a PR based on the proposition here: #140
fardad-dev commentedon Aug 14, 2020
#205
This way we could work with any animated react-native or react-native-reanimated or something different