【问题标题】:React-Native, unable to align button at bottom in iPhone XReact-Native,无法在 iPhone X 底部对齐按钮
【发布时间】:2019-03-14 04:25:50
【问题描述】:

我正在为按钮应用一些样式。 Motive is 按钮应该在父底部对齐,并且从底部有一些边距或填充。

所以我应用了下面的样式

bottomView: {
  width: '85%',
  height: 50,
  marginLeft: 10,
  marginRight: 10,
  borderRadius: 5,
  flexDirection: 'row',
  backgroundColor: ColorConstants.COLOR_BUTTON,
  justifyContent: 'center',
  alignItems: 'center',
  alignSelf: 'center',
  position: 'absolute',
  bottom: 25
}

我在 Android 设备上检查过,iPhone 模拟器运行良好。但这不适用于 iPhone X 模拟器。

有什么建议吗?

【问题讨论】:

    标签: ios react-native react-native-ios


    【解决方案1】:

    不得不提,在SafeAreaView:

    <SafeAreaView style={{flex: 1, backgroundColor: '#fff'}}>
    // Your Code//
    </SafeAreaView>
    

    【讨论】:

      猜你喜欢
      • 2022-11-11
      • 2017-01-29
      • 1970-01-01
      • 1970-01-01
      • 2021-06-10
      • 2019-07-26
      • 2021-05-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多