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

94
Visualizações
Is there any ways to use react navigation props as a define object in reusable component?

I start using rn this week to make a medium scale app for some tutoring school. And found some problem with navigating with defined props.

As u will see i define the stack screen name with 'test1', 'test2' in root app.js same with address variable.

the problem is when i use 'test1' instead of {address} it is working fine, but when i use {address}, it's yelling at me, even when i console it's still 'test1'.

Here's my code :

....
....

    <Stack.Screen name="test1" component={GrLesson1} />
    <Stack.Screen name="test2" component={GrLesson2} />

    function GrHome({navigation}) {
        return (
    <View>
    
    <GrHomeProps title="test1" address="test1" navigation={navigation}/>
    <GrHomeProps title="test2" address="test2" navigation={navigation}/>
    
    </View>
        )
    }


function GrHomeProps({title,navigation,address}) {
    return (
<View>
<TouchableOpacity
onPress={()=>{
navigation.navigate({address})

}}
>

   <Text> {title} </Text>
</TouchableOpacity>
</View>
    )
}

Can somebody help me? find the mistake i made or teach me another way to do this with reusable component?
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

without curly brackets

navigation.navigate(address)
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