1.14.0 • Published 2 years ago

react-native-use-idle v1.14.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

A simple way to detect inactivity.

// you need to add IdleProvider at the top level
const isIdle = useIdle()

Getting Started

Install

yarn add react-native-use-idle

Add the Provider At the Top Level

import { IdleProvider } from "react-native-use-idle";

// top level of code you want to monitor
const App = () => {
    return (
        // optionally set a timeForInactivity variable (default 30s)
        <IdleProvider>
            {...your app}
         </IdleProvider>
    )
}

Using useIdle

import { useIdle } from "react-native-use-idle";

const Component = () => {
    const isIdle = useIdle();
    useEffect(() => {
         if (!isIdle) console.log("not idle");
         console.log("is idle");
    },[])
}
1.14.0

2 years ago

1.13.0

2 years ago

1.12.0

2 years ago

1.11.0

2 years ago

1.10.0

2 years ago

1.9.0

2 years ago

1.8.0

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago