Header Component overrides StatusBar
See original GitHub issueWhen using the Header component it is overriding the StatusBar text theme to always be dark.
Is there a way to use the Header component but still override the StatusBar theme to have light-content?
Sample code below to test.
Here is the Snack I used for testing: https://snack.expo.io/BkcKiBtg7
Does NOT work:
import React, { Component } from 'react';
import { Text, View, StyleSheet, StatusBar } from 'react-native';
import { Header, Content } from 'native-base';
export default class App extends Component {
render() {
return (
<View style={{flex:1, backgroundColor:'red'}}>
<StatusBar barStyle="light-content" />
<Header>
<Text>Header</Text>
</Header>
<Content />
</View>
);
}
}
DOES work (but have to disable the Header component with using a View):
import React, { Component } from 'react';
import { Text, View, StyleSheet, StatusBar } from 'react-native';
import { Header, Content } from 'native-base';
export default class App extends Component {
render() {
return (
<View style={{flex:1, backgroundColor:'red'}}>
<StatusBar barStyle="light-content" />
<View>
<Text>Header</Text>
</View>
<Content />
</View>
);
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Configuring the header bar - React Navigation
A Screen component accepts options prop which is either an object or a function that returns an object, that contains various configuration options....
Read more >Configuring the status bar - Expo Documentation
The StatusBar component provided by expo-status-bar allows you to control the appearance of the status bar while your app is running. expo-status-bar also ......
Read more >Customizing your React Native status bar based on route
Learn to master status bars in React Native for any device by using the StatusBar component and the imperative API.
Read more >StatusBar - React Native
It is possible to have multiple StatusBar components mounted at the same time. The props will be merged in the order the StatusBar...
Read more >Can I override the color of default header and the footer
You can use the component StatusBar . Just make sure to add it above your navigator styles or other component
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@svallen use
iosBarStyle
style props of header component. This will work for android too. Also try to use NativeBase components. Read about NativeBase screen structure here. Attaching a gifCode
Gif
This still has problems on Picker’s Header as that part is not directly styleable.