Open nbAmit opened 2 years ago
You can try saving and getting the data with async storage. It's not the best way but it works for now.
const detectIdle = async activeState => {
const isLogin = await stgGetIsLogin();
if (isLogin && !activeState) {
_logOut();
}
};
<UserInactivity
isActive={isActive}
timeForInactivity={activityTime}
onAction={detectIdle}>
...
</UserInactivity>
You can create a copy of the state into useRef and then pass it, worked for me.
I'm trying to logout user he/she us inactive for x number of minutes, I have two different different scenarios
So I am checking here if user is inactive on any of the Onboarding screens then I have to restart the Onboarding flow, If user login into the app then I have show the idle screen. For checking this status I am using the react native store but when onAction method call it always return the old store.