ReactNative——如何隐藏状态栏(实现沉浸式)

RN中隐藏状态栏的方式很简单,在页面的根布局的顶部添加一个StatusBar即可,设置相关属性如下:

export default class MainPage extends Component {
    render() {
        return(
            <View style={{flex: 1}}>
                <StatusBar backgroundColor="#ff0000"
                           translucent={true}
                           hidden={true}
                           animated={true}/>
                <Text>HelloWord</>
            </View>
        )
    }
}

 

原文链接:https://blog.csdn.net/qq_28484355/article/details/81320019

posted @ 2020-05-20 09:55  _DC  阅读(1928)  评论(0编辑  收藏  举报