Reputation: 89
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.
Upvotes: 0
Views: 4641
Reputation: 83
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
Upvotes: 1