I’ve tried panResponder to test the display idle. but it surely would not work. i’m not what mistake i executed.
const timerId = useRef(false)
const [timeForInactivityInSecond, setTimeForInactivityInSecond] = useState(
1000
)
useEffect(() => {
resetInactivityTimeout()
}, [])
const panResponder = React.useRef(
PanResponder.create({
onStartShouldSetPanResponderCapture: () => {
// console.log('consumer begins contact');
resetInactivityTimeout()
},
})
).present
const resetInactivityTimeout = () => {
clearTimeout(timerId.present)
timerId.present = setTimeout(() => {
console.log("amss")
// motion after consumer has been detected idle
}, timeForInactivityInSecond * 1000)
}
In react-native we’ve a number of display. so how can we discover that the display is idle to logout the session. Can anybody please assist me to kind out this challenge.