React-Native : How to get the complete height of the device when 'Full Screen Mode' is enabled?

Kis*_*ore 3 android-fullscreen react-native react-native-android

我正在Window通过Dimensions.get('window').height在屏幕上使用和渲染内容来提高身高。但是,Full Screen Mode启用后,硬件按钮将被隐藏,这会导致屏幕上有额外的空间。但是仍然Dimensions.get('window').height具有与以前相同的高度(Full Screen Mode禁用时)。最终,屏幕最终会留下多余的空间。

有什么办法react-native可以渲染内容Full Screen Mode

而且,启用“全屏模式”时如何获取设备的完整高度?

And*_*rew 6

Dimensions API window和之间有区别screen

在大多数情况下 Dimensions.get('window').height !== Dimensions.get('screen').height

这样的答案很好地描述了差异 /sf/answers/3148552921/

tl; dr

  • window:报告宽度/高度,而不显示软菜单栏
  • screen:报告整个屏幕的宽度/高度

我想你想用screen而不是window

另外,您可以在样式中尝试类似

{ top: 0, bottom: 0, left: 0, right: 0 }

它应该覆盖整个屏幕