Everytime i try to set a custom header in stacknavigation the error appears: "cant find variable View". When i replace the component with just a text, it works.
Error appears everytime i use the class "LogoTitle" for the headerTitel
tryied to use a const insted of a class, but dosent worked
const TabNavigation = createMaterialTopTabNavigator({
AllChats: { screen: AllChatsScreen,
navigationOptions: {
tabBarLabel: "Chats",}}});
class LogoTitle extends React.Component {
render() {
return (
<Image
source={require('./spiro.jpg')}
style={{ width: 30, height: 30 }}/>);}}
const SignedInn = createStackNavigator({
TabNavigation: {
screen: TabNavigation,
},},{
navigationOptions: {
headerTitle: <LogoTitle/>}})
export const createRootNavigator = (signedIn = false) => {
return createSwitchNavigator(
{
SignedIn: {
screen: SignedInn}});};
you need to use header instead of headerTitle to be able to use View
const SignedIn = createStackNavigator ({
TabNavigation:{screen: TabNavigation,
navigationOptions: ({navigation}) => ({
header: <LogoTitle navigation= {navigation} />,
})
},
})
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