【发布时间】:2020-03-19 18:31:18
【问题描述】:
我尝试向应用程序添加状态栏,它在 React-Navigation Header 上添加了额外的填充
状态条码
const STATUSBAR_HEIGHT = Platform.OS === 'ios' ? 30 : StatusBar.currentHeight;
const NotificationBar = ({ backgroundColor, ...props }) => ({
...(Platform.OS == 'ios' ? (
<View style={{ backgroundColor, height: 30 }}>
<StatusBar translucent backgroundColor={backgroundColor} {...props} />
</View>
) : (
<StatusBar translucent backgroundColor={backgroundColor} {...props} />
)),
});
const styles = StyleSheet.create({
statusBar: {
height: STATUSBAR_HEIGHT,
},
});
app.js
<Provider store={store}>
<NotificationBar
backgroundColor={Colors.SAPrimaryx}
barStyle="light-content"
/>
<PersistGate persistor={persistor}>
<RootRouter />
</PersistGate>
</Provider>
我该如何解决?
【问题讨论】:
标签: javascript react-native statusbar