I want to know how to hide toolbar which is being added by default after implementation of react-navigation
https://reactnavigation.org/
I have two screens - Launcher screen where I do not want a toolbar and 2nd screen where it is OK to have toolbar.
index.android.js
/**
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from "react";
import {
AppRegistry,
Image,
View,
Text,
Button,
StyleSheet
} from "react-native";
import { StackNavigator } from "react-navigation";
import EnableNotificationScreen from "./EnableNotification";
class SplashScreen extends Component {
render() {
console.disableYellowBox = true;
const { navigate } = this.props.navigation;
return (
<View style={styles.container}>
<Image source={require("./img/talk_people.png")} />
<Text style={{ fontSize: 22, textAlign: "center" }}>
Never forget to stay in touch with the people that matter to you.
</Text>
<View style={{ width: 240, marginTop: 30 }}>
<Button
title="CONTINUE"
color="#FE434C"
onPress={() => navigate("EnableNotification")}
/>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
backgroundColor: "#FFFFFF",
alignItems: "center",
justifyContent: "center",
padding: 16,
flex: 1,
flexDirection: "column"
}
});
const ScheduledApp = StackNavigator(
{
Splash: { screen: SplashScreen },
EnableNotification: { screen: EnableNotificationScreen }
},
{
initialRouteName: "Splash"
}
);
AppRegistry.registerComponent("Scheduled", () => ScheduledApp);
EnableNotification.js
/**
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from "react";
import { View, Text } from "react-native";
export default class EnableNotificationScreen extends Component {
render() {
return <View><Text>Enable Notification</Text></View>;
}
}
static navigationOptions = {
header: null ,
};
this works for me
class SplashScreen extends Component {
static navigationOptions = {
header: null ,
};
render() {
console.disableYellowBox = true;
const { navigate } = this.props.navigation;
return (
...
);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With