Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

139
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda