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

146
Visualizações
Warning: Cannot update a component from inside the function body of a different component. in TouchableOpacity

I got this error

Warning: Cannot update a component from inside the function body of a different component.

How to fix this ?

When I remove touchable opacity, it's not showing anymore

                  <View style={styles.SaD}>
                            <TouchableOpacity onPress={(e) = props.locationSetState(1)}> // here
                                <Text style={styles.text1}>Choose your starting point</Text>
                            </TouchableOpacity>

                            <TouchableOpacity onPress={(e) = props.locationSetState(2)}>
                                <Text style={styles.text1}>Choose destination</Text>
                            </TouchableOpacity>
                        </View>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

details are not sufficient to understand your problem but according to what I understand from your code try using react hooks and try this

function App() {

  const [state,setState]=React.useState(null);
  console.log(state);
  return (
                       <View style={styles.SaD}>
                            
                            <TouchableOpacity onPress={(e) => setState(1)}>
                                <Text style={styles.text1}>Choose destination</Text>
                            </TouchableOpacity>
                            <TouchableOpacity onPress={(e) => setState(2)}>
                                <Text style={styles.text1}>Choose destination</Text>
                            </TouchableOpacity>
                        </View>
  );
}
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