On my iOS emulator they both return the same values.
I understand the difference on a normal browser, but what is the difference on React Native? Are there scenarios where they return differente values?
See Question&Answers more detail:osOn my iOS emulator they both return the same values.
I understand the difference on a normal browser, but what is the difference on React Native? Are there scenarios where they return differente values?
See Question&Answers more detail:osThe documentation on Dimensions is quite poor (outstanding issue), so you'll have to dive into the code to understand what is going on. If you look at the source of Dimensions, you'll see this comment on line 47:
// Screen and window dimensions are different on android
If you trace back the history using blame, you'll find this commit on the relevant section of code pointing to this old issue which itself points to this issue about Dimensions reporting different screen heights.
I don't know enough about Android itself, but from what I can gather, it appears that Android can report back two different numbers:
A quick test on my Android device printing out these values and I was able to confirm that window
's height < screen
's height. So in all likelihood, this means:
window
: reports width/height without the soft menu barscreen
: reports entire screen's width/heightI didn't follow back this product pain about orientation changes on Android, so I don't know how rotating your screen affects this.