gpt4 book ai didi

react-native - react native 状态栏

转载 作者:行者123 更新时间:2023-12-05 07:32:59 26 4
gpt4 key购买 nike

我正在尝试在我的 android 模拟器上设置 statusBar 的样式,它的颜色太深且太绿。如何设置高度?

 render() {
const { navigationState, dispatch } = this.props;
return (
<View>
<StatusBar translucent backgroundColor="#000" />
<View style={styles.appBar} />
<View style={styles.content} />

<NavigationStack
navigation={addNavigationHelpers({
dispatch,
state: navigationState,
addListener
})}
/>
</View>
);
}
}


const STATUSBAR_HEIGHT = Platform.OS === "ios" ? 20 : StatusBar.currentHeight;
const APPBAR_HEIGHT = Platform.OS === "ios" ? 44 : 56;

const styles = StyleSheet.create({
container: {
flex: 1
},
statusBar: {
height: STATUSBAR_HEIGHT
},
appBar: {
backgroundColor: "#79B45D",
height: APPBAR_HEIGHT
},
content: {
flex: 1,
backgroundColor: "#33373B"
}
});

enter image description here

最佳答案

render() {
const { navigationState, dispatch } = this.props;
return (
<View style={styles.container}>
<StatusBar
backgroundColor="blue"
barStyle="light-content"
/>

<NavigationStack
navigation={addNavigationHelpers({
dispatch,
state: navigationState,
addListener
})}
/>
</View>
);
}
}

关于react-native - react native 状态栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50837533/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com