react 原生 : How to get the complete height of the device when 'Full Screen Mode' is enabled?

标签 react-native react-native-android android-fullscreen

我正在服用 Window高度使用 Dimensions.get('window').height并在屏幕上呈现内容。但是当 Full Screen Mode已启用硬件按钮被隐藏,这会导致屏幕上有额外的空间。但还是Dimensions.get('window').height给出与以前相同的高度(当 Full Screen Mode 被禁用时)。最终 screen 最终会有一个额外的空间。

有什么办法在react-native根据 Full Screen Mode 呈现内容?

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

最佳答案

window之间有区别和 screen在维度 api 中。
大多数情况下Dimensions.get('window').height !== Dimensions.get('screen').height这个 SO 答案在描述差异方面做得很好
https://stackoverflow.com/a/44979327/5508175
tl;博士

  • window : 在没有软菜单栏的情况下报告宽度/高度
  • screen : 报告整个屏幕的宽度/高度

  • 我想你想用 screen而不是 window或者在你的造型中,你可以尝试类似的东西{ top: 0, bottom: 0, left: 0, right: 0 }它应该覆盖整个屏幕

    关于 react 原生 : How to get the complete height of the device when 'Full Screen Mode' is enabled?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54364798/

    相关文章:

    react-native - 任务 ':app:processDebugResources' 执行失败。 > 安卓资源链接失败可以再构建RN安卓版

    android - relativelayout 中的线性布局不适合全屏

    android - android中的沉浸式模式,只有透明度

    ios - react native 0.60.3 与 xcode 9.4.1

    react-native - 为什么 React Native Navigation v2 图标未在 iOS 中显示?

    reactjs - 如何在使用 expo-image-picker 时添加图像类型和大小限制(比如我只能选择 jpeg 类型的图像和 2000kB 的最大内存)

    react-native - 如何为 IOS 生成 Release 版本..?

    android - 从Play商店下载时无法加载应用程序,但可以安装生成的APK

    android - Android中的全屏 Activity ?

    javascript - 有没有办法在 react-native 中缩放 View ?