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

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

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 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