0

I want to do user session logout when user is inactive for certain time. Actually we have three modules like sign up flow, login flow and dashboard screens. In signup flow there are around 20 screens. Once user completes signup flow,than he can login and navigate to dashboard screens. This session logout will only enable for dashboard screens. I tried react-native-userinactive package, user interaction provider package and these will work only for single component. Also tried by using Panhandlers the same result. I want to use globally not for applying single component. Any suggestions on how to use this.

Manikanta
  • 89
  • 2
  • 14

1 Answers1

1

You can refer to the following change to track inactivity: How to know if a react native app goes to background?

In _handleAppStateChange, store a timestamp in AsyncStorage. Whenever a user opens the app, immediately retrieve timestamp from AsyncStorage and check against your inactivity period, if true, redirect to Login Screen

Saurabh
  • 83
  • 3
  • 9
  • 1
    This will call when user goes to background/foreground. But my requirement is user is in active state(foreground) and he is not use the app(no touch events). The use is idle for certain time than i need to take into login screen. – Manikanta Mar 27 '20 at 04:20