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

120
Vistas
UseEffect is working without of focus react navigation

im have two screens at same stack

    <TravelStack.Navigator
      screenOptions={{
        headerTitle:"",
        headerStyle:{
          backgroundColor:"black"
        },
        
        headerLeft:()=><Ionicons name="menu-outline" 
        size={30} 
        style={{marginLeft:6}}
        color="#45c7e8" />,

        headerRight:()=> <Ionicons name="notifications-outline" style={{marginRight:6}} size={30} color="#45c7e8" />
      }}
    >
      <Tabs.Screen 
        name="Travel" 
        component={Viajes}
        options={{
          unmountOnBlur: true
        }}
      />
      <Tabs.Screen 
        name="Conductor" 
        component={ConductorOptionsScreen} 
        options={{
          unmountOnBlur: true
        }}
      /> 
      </TravelStack.Navigator>

And im calling two metods using useEffect at "Travel" screen

const isFocused = useIsFocused();  

useEffect(() => {
    setLoading(true)
    verifyState()
    const interval = setInterval(() => {
      verifyState()
    }, 60000);
    return () => clearInterval(interval); 
 }, [isFocused]);

when im navigate to screen 2 in this case "Conductor Screen" After a while the method "setLoading" is working but im not calling this method into "verifyStateFunction", im triying to use the options "unmountOnBlur" but does not working could someone help me understand what is going on?

update im triying replace method for this but does not working

useEffect(() => {
    const unsubscribe = navigation.addListener('focus', () => {  
      setLoading(true)
      verifyState()
    });
    return unsubscribe;
  }, [navigation])

useEffect(() => {
   const interval = setInterval(() => {
    verifyState()
   }, 60000);
    return () => clearInterval(interval); 
}, []);

about 4 years ago · Juan Pablo Isaza
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