To remove top header from the navigation with React Native, we can set the static navigationOptions.header
propety to null
or callnavigation.setOptions
.
For instance, we write
export default class Login extends Component {
static navigationOptions = {
header: null,
};
}
to set the navigationOptions.header
property to null
in our component to remove the header.
Also, we can write
setTimeout(() => {
navigation.setOptions({
header: () => (
<View style={{ backgroundColor: "white" }}>
<Text
style={[
{ color: "white" },
Platform.OS === "android" ? { fontSize: 20 } : { fontSize: 1 },
]}
>
.
</Text>
</View>
),
});
}, 1);
to call call navigation.setOptions
with an object with the header
property set to a white View
to hide the header.