我注意到StatusBar组件(React Native)没有提供类似于文档中的图标或徽标的props: https://facebook.github.io/react-native/docs/statusbar.html#statusbar
我希望应用在后台运行时,可以在网络栏旁边连续显示一个图标(甚至只是一个小的宽x高的正方形)。我尝试将View组件与StatusBar组件组合使用,创建一个小的红色矩形,如下所示:
<View style={styles.container}>
<StatusBar
backgroundColor="blue"
barStyle="light-content"
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
width: 20,
height: 20,
backgroundColor: 'red'
}
})
然而,红色的正方形只出现在状态栏下面。 有什么想法吗?
编辑:
我的目标是即使应用程序在后台运行,也要在状态栏中使用我的应用程序标志(提供VPN和位置服务的应用程序有时会这样做)。