Support changing `onAction` prop
The timers ignore changes to onAction, therefore when it changes the timeout calls the first version of the function that was passed, and not the latest. This is what causes issues like #46 and #54. I imagine the solution might not be that straightforward, since resetting the timer every time this prop changes would be unwanted, but perhaps a good solution would be to use a ref to the onAction inside the timeout callback, and updating that ref with the value of onAction on every render. This way, a stale closure isn't called when the timeout ends.
I was facing the same issue as the function was calling the old version and fixed it by creating the copy of the state and storing it into useRef
use this https://github.com/MuhammadRafeh/react-native-inactivity