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.
Asked
Active
Viewed 3,663 times
0
-
By "inactive" do you mean that the app itself is active, but there is no user interaction with the app, or do you mean the user literally inactivates the app? – Benjamin Godlove Mar 21 '20 at 19:02
-
App is active only and there is no user interaction for 10 mins like that – Manikanta Mar 22 '20 at 02:48
-
have you found a solution for this problem? – Andrey Solera Mar 30 '21 at 17:07
1 Answers
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
-
1This 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