hooks icon indicating copy to clipboard operation
hooks copied to clipboard

useKeyboard() keyboardHeight is always 0 for first time

Open yanel777 opened this issue 3 years ago • 5 comments

yanel777 avatar Mar 31 '21 09:03 yanel777

The same Issue Here, when I created a useEffect on keyboard.keyboardShown keyboard height is not showing properly. iPhone 11 (Similator) React Native : 0.63.X

areebmkareem avatar Apr 05 '21 18:04 areebmkareem

I think this happens because to measure the keyboard height, it should be shown at least one time. I didn't see the code, so I'm sorry if I'm wrong. I made a similar hook by my hand before, and this is the only way it worked. If you do not feel uncomfortable with it, you can add an invisible text input somewhere, and on app startup, you trigger its focus and then blur it. The keyboard will flash, but you will have the correct value. It is not perfect but can help while we don't have a better way.

italomlp avatar Apr 06 '21 20:04 italomlp

The keyboard.keyboardShown value is incorrect (version: 2.8.1). I have to compare the coordinates start & end to determine if the keyboard is actually shown.

liemdo avatar Feb 06 '22 06:02 liemdo

I can also reproduce this. keyboardHeight is only non-zero after using the keyboard at least once

princefishthrower avatar Mar 15 '22 14:03 princefishthrower

Is there any fix for this? it's still happening for Android

davepaiva avatar Feb 14 '24 13:02 davepaiva