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

241
Views
How can I track screen time of user when a user navigate to specific screen in react native?

I want to track the time when a user navigates through the screen and when it leaves the screen. I also want to set state and then send those data to API.

const Stack = createStackNavigator();
const Tab = createMaterialTopTabNavigator();
export default function BootcampWeeksScreen(props){
    const { navigation } = props;
const pathway_id=navigation.getParam('pathway_id');
  return (


    <NavigationContainer>
      <Tab.Navigator tabBarOptions={{ scrollEnabled: true }}>
      <Tab.Screen name="Course" component={Courses} initialParams={{pathway_id:pathway_id}} />
        <Tab.Screen name="Roadmap" component={Roadmap} />
      </Tab.Navigator>
    </NavigationContainer>
  );
}

When a user navigates to the Course screen I want to track that time when the user leaves the screen.

How can I do this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can do it by storing the time in global variable that is accessible throughout the components. you can use react context or redux for that.

when the user navigates to other page you could probably use

useEffect(()=>{

return ()=>{
  //  when the user navigated to another page this gets execute
  // setting of new date will be from here
 }
},[])
about 4 years ago · Juan Pablo Isaza Report
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!