Comments (3)
@jkomyno Does the current implementation in the dev branch support custom timers? It appears to support them, despite this PR being open, but I'm having issues implementing BackgroundTimer as referenced. When using BackgroundTimer, I see some weird inconsistencies, such as the onAction
function firing too frequently (faster than the timeForInactivity interval).
I'm implementing like so, with useEffect as I will eventually need to dispatch a Redux action when the user has gone inactive:
const TIMEOUT_BEFORE_PROMPTING_USER_IN_MILLISECONDS = 10000;
const InactiveLogout = ({ children }) => {
const [active, setActive] = useState(true);
useEffect(() => {
const resetInactivityTimer = () => setActive(true);
if (!active) {
Alert.alert('youve gone inactive');
}
}, [active, setActive]);
return (
<UserInactivity
timeForInactivity={TIMEOUT_BEFORE_PROMPTING_USER_IN_MILLISECONDS}
timeoutHandler={BackgroundTimer}
onAction={isActive => setActive(isActive)}
isActive={active}
>
{children}
</UserInactivity>
);
};
Any help is much appreciated!
from react-native-user-inactivity.
@dylinmaust Now it supports them.
from react-native-user-inactivity.
@dylinmaust we have having same issues regarding stopBackgroundTimer
and runBackgroundTimer
of react-native-background-timer
lib, see also:
we just can't use https://github.com/jkomyno/react-native-user-inactivity/blob/master/src/BackgroundTimer.ts provided by react-native-user-inactivity
because of these issues and then we have to provide our own Android implementation
from react-native-user-inactivity.
Related Issues (20)
- Unable to install the package on RN 39.0.4 HOT 2
- react-native-user-inactivity not working in Android 10 HOT 6
- Keeps timing users out while using the app HOT 2
- Is User considered active while watching a video? HOT 2
- getting incorrect values from redux inside onAction HOT 2
- Timer doesnot get inactive once started? How to do it HOT 1
- Keyboard activity outside this App HOT 1
- Congratulations and thank u! HOT 1
- Improve README.md
- Input from keyboard is not considered as an action HOT 4
- How to stop timer while navigating on next Screen? HOT 1
- Not getting updated values from store inside onAction HOT 2
- ERESOLVE unable to resolve dependency tree HOT 5
- expo demo need update, not working
- Support React 18 HOT 3
- Support changing `onAction` prop HOT 1
- Sometimes does not detect user interaction on android devices HOT 2
- node module download error
- onAction not called when app is in background (Android)
- isAction prop does not work properly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-user-inactivity.