我在使用React Native时遇到了一些麻烦。我有一个屏幕,需要一个自定义标题(带有图标和更多内容),因此在navigationOptions
中,我将使用headerTitle
而不是title
。
问题是,使用headerTitle
时,组件中不包含状态栏。所以我有这样的东西:
headerTitle: () => <MyHeader />
然后:
const MyHeader = props => {
return(
<View style={{flex: 1,backgroundColor: 'red',height: '100%',padding: 10,justifyContent: 'center'}}>
<Text style={{color: 'white'}}>Testing</Text>
</View>
)
}
我明白了:
我尝试这样做:
How to set iOS status bar background color in React Native?
但是没有用。
这是我的预期结果:
我可以使用headerStyle
中的headerTitleStyle
和navigationOptions
来做到这一点,但是我不能使用自定义组件...