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

Fixed issue of incorrectly getting the height/width on Android devices. #224

Closed

Conversation

ifsnow
Copy link
Contributor

@ifsnow ifsnow commented Nov 16, 2018

I found RN has 2 metrics(window/screen) in Dimensions.
I don't exactly know why these exist. It makes people feel confused.

  • iOS : Dimensions.get("window") == Dimensions.get("screen")
  • Android : Dimensions.get("window") != Dimensions.get("screen")

react-native-extra-dimensions-android uses screen values. so, If screen values are used internally, we do not need to use any other library and pass the props. This patched version works well on the device where the problem occurred.

I hope this helps.

@mmazzarolo
Copy link
Member

Hey!
As far as I know react-native-extra-dimensions-android doesn't just use screen, it also ships native code

@mmazzarolo
Copy link
Member

@ifsnow
Copy link
Contributor Author

ifsnow commented Nov 16, 2018

@mmazzarolo I thought so. But, You can see that the logic of react-native-extra-dimensions-android and react-native is the same and RN provides screen metrics.

Dimensions.get("screen").height == require("react-native-extra-dimensions-android").get("REAL_WINDOW_HEIGHT")

I have already checked if this version works as intended on various Android devices.
Please let me know you have any concerns about this.

@RichardLindhout
Copy link
Contributor

I can confirm it too be working on the POC branch where the modals had space at the bottom.

@mmazzarolo
Copy link
Member

@RichardLindhout do you mind do a quick check to see if this solution works as well?
Thank you.

@CarterBland
Copy link

I tested this branch and I'm still seeing an error.

@mmazzarolo
Copy link
Member

@ifsnow I know I'm late, thanks again for submitting the PR but I'm closing it because we're still investigating which one of window and screen is the best option (they both works in different cases) and they can still be provided trough the deviceHeight and deviceWidth props manually.
Thanks for proposing the solution!

@mmazzarolo mmazzarolo closed this May 2, 2019
@ifsnow ifsnow deleted the fix/wrong-device-height branch December 17, 2020 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants