【问题标题】:React-Native button going behind Samsung S10 camera三星 S10 相机后面的 React-Native 按钮
【发布时间】:2020-09-02 09:26:53
【问题描述】:

最近我遇到了一个问题,即我的应用程序在自定义标题上的勾选按钮已经落后于三星 S10 相机,我在我的应用程序中使用透明状态栏,在三星 S10 中,相机从顶部略低于所以它出现在应用程序视口中,我不确定其他设备,但有没有办法可以检测到这些东西,并在此基础上我可以更改样式或如何克服这些问题

【问题讨论】:

    标签: javascript react-native mobile react-native-android samsung-mobile


    【解决方案1】:

    试试这个..

    import { SafeAreaView, Platform } from "react-native";
    
    render() {
        return (
          <SafeAreaView style={{
            flex: 1,
            backgroundColor: 'blue',
            paddingTop: Platform.OS === 'android' ? 25 : 0}}>
              //More controls and such
          </SafeAreaView>
        );
      }
    }
    

    根据您的要求进行调整..

    【讨论】:

      【解决方案2】:

      我已使用“react-native”库中的 StatusBar.currentHeight 来解决此问题,因为这将提供状态栏的实际高度,而不是使用任何静态高度

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-11-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多