Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
My tab navigation header button doesnt working. How can I fix it?

I'm trying to learn react native and I have a problem. Here I use tab navigation and I want to add an image in my headers right side and when the users touch that image I want use navigator, but it doesn't work.

import React, { useEffect, useState } from 'react'
import { View, StyleSheet, Image, TouchableOpacity } from 'react-native'
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
import { createStackNavigator } from '@react-navigation/stack';


const TabNavigation = ({ navigation }) => {

    return (
    enter code here

 <Tab.Screen
          name="Home"
          component={HomeScreen}
          options={{
            headerTitle: () => (<Image source={require('../Images/Floody.png')} />),
            headerStyle: {
              height: 100
            },
            headerTitleAlign: 'center',
            headerRight: () => (
              <TouchableOpacity>
                <Image source={require('../Images/profile.jpg')} />
              </TouchableOpacity>
            ),
            tabBarIcon: ({ focused }) => focused ? <HomeImageColorfull /> : <HomeImageBlack />
          }} />
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The navigation object is passed by the navigation framework to the options of the screen. Hence, you can implement a onPress function for your TouchableOpacity of your headerRight component and use the navigation object from the options.

<Tab.Screen
   name="Home"
   component={HomeScreen}
   options={({navigation}) => ({
            headerTitle: () => (<Image source={require('../Images/Floody.png')} />),
            headerStyle: {
              height: 100
            },
            headerTitleAlign: 'center',
            headerRight: () => (
              <TouchableOpacity onPress={() => navigation.navigate("SomeScreenToNavigateTo")}>
                <Image source={require('../Images/profile.jpg')} />
              </TouchableOpacity>
            ),
            tabBarIcon: ({ focused }) => focused ? <HomeImageColorfull /> : <HomeImageBlack />
          })} />
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda