SupremeTechnopriest / react-idle-timer

User activity timer component
https://idletimer.dev
MIT License
1.15k stars 143 forks source link

change isIdle=false as default value #304

Closed sivakannan closed 1 year ago

sivakannan commented 2 years ago

https://github.com/SupremeTechnopriest/react-idle-timer/blob/d343d4d189dffe46c86dcc07b863da19cc98409a/src/useIdleTimer.tsx#L59

I am creating react-idle-timer as utility, my utility will return isIdle. Based on that we are showing popup in frontend. However we are receiving isIdle=true and after some point of time when timer started, we are receiving isIdle=false.

we need isIdle=false as default value. kindly suggest.

SupremeTechnopriest commented 2 years ago

If you call start when the hook mounts the isIdle state will toggle to false. I will consider changing the default to false in the next release.

sivakannan commented 2 years ago

If you call start when the hook mounts the isIdle state will toggle to false. I will consider changing the default to false in the next release.

thanks for your quick response. do you have any suggestion to fix(isIdle = false) in meanwhile ?

` const {start, isIdle} = useIdleTimer({'startOnMount': false, 'startManually': true});

useEffect(() => { start(); },[start])

//first time false, second time when it start it return true return { isIdle } `

SupremeTechnopriest commented 1 year ago

Idle will default to false with version 5.5.0. Should have it published this week!

sivakannan commented 1 year ago

When are we planning for the release? just to plan. @SupremeTechnopriest

SupremeTechnopriest commented 1 year ago

I'm just getting over being sick. It kind of put a damper on my plans. I'm gonna work on the release this week and hopefully have it out next by the end of the week.

sivakannan commented 1 year ago

@SupremeTechnopriest thanks. Hope you feel better now.