Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!