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

useKeyboard() keyboardHeight is always 0 for first time #226

Open
yanel777 opened this issue Mar 31, 2021 · 5 comments
Open

useKeyboard() keyboardHeight is always 0 for first time #226

yanel777 opened this issue Mar 31, 2021 · 5 comments

Comments

@yanel777
Copy link

No description provided.

@areebmkareem
Copy link

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

@italomlp
Copy link

italomlp commented Apr 6, 2021

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.

@liemdo
Copy link

liemdo commented Feb 6, 2022

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.

@princefishthrower
Copy link

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

@davepaiva
Copy link

davepaiva commented Feb 14, 2024

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

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

No branches or pull requests

6 participants