繁体   English   中英

在iOS中使用react-native设置半透明statusBar

[英]Set translucent statusBar in iOS with react-native

我试图在带有React-Native的iOS上不具有半透明(默认)的StatusBar,但似乎此选项仅在Android上可用?

class THapp extends Component {
  render() {
    return (
      <View style={styles.container}>
        <StatusBar translucent={false} backgroundColor="rgba(0, 0, 0, 1)" barStyle="default"/>
        <Tabs></Tabs>
      </View>
    );
  }
}

可能您以其他方式解决了此问题,但我遇到了同样的问题。 为了解决这个问题,我正在实现独立于平台的marginTop或paddingTop。

import {Platform} from 'react-native';
// Status bar height on iOS is 20 dpi
const marginTop = Platform.OS === 'ios' ? 20 : 0;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM