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

Keyboard height is incorrect on iPhone X #62

Closed
kotromeo opened this issue Jan 9, 2019 · 3 comments · May be fixed by #66
Closed

Keyboard height is incorrect on iPhone X #62

kotromeo opened this issue Jan 9, 2019 · 3 comments · May be fixed by #66

Comments

@kotromeo
Copy link

kotromeo commented Jan 9, 2019

Using event keyboardDidShow, getting keyboard height and it's about 379 but should be 760

@matejkramny
Copy link

you're not accounting for pixel density of ~2 so it works out to around 760. I'm having the same issue, going to post a PR fixing this.
The keyboard height is correct. What it's not doing is accounting for the 'safe' area inset of the bottom bar.

https://medium.com/rosberryapps/ios-safe-area-ca10e919526f

@kotromeo
Copy link
Author

kotromeo commented Jan 29, 2019

you're not accounting for pixel density of ~2 so it works out to around 760. I'm having the same issue, going to post a PR fixing this.
The keyboard height is correct. What it's not doing is accounting for the 'safe' area inset of the bottom bar.

https://medium.com/rosberryapps/ios-safe-area-ca10e919526f

So problem on my side to determine 2x density or this problem on plugin side ?

@jcesarmobile
Copy link
Member

The plugin return the size in points, and the size is correct.
For iPhone X, 1 point = 3 pixels, that means its screen is 2436x1125 pixels, but 812x375 points.

If you have a viewport like this <meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> then your css values will also be considered as points, meaning your app resolution is really 812x375 pixels, not 2436x1125.

If for some reason you need the real pixels, you'll have to multiply the returned keyboard size by devicePixelRatio (which is 3 for iPhone X).

Not sure where you get that size should be 760

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

Successfully merging a pull request may close this issue.

3 participants