UserInactivity
A component that detects user inactivity by monitoring touch events and keyboard interactions. When the user hasn't interacted with the app for a specified duration, it triggers a callback. This is useful for implementing session timeouts, auto-logout features, or any functionality that depends on user activity state. No demo is available as this component requires app-level integration.
Package: @terreno/ui
Categories: Component
Props interface: UserInactivityProps
Story source: demo/stories/UserInactivity.stories.tsx
Live demo
Props
| Prop | Type | Required | Description |
|---|---|---|---|
children | ReactNode | Yes | Children components to embed inside UserInactivity's View. If any children component is pressed, |
onAction | reflection | Yes | Callback triggered anytime UserInactivity's View isn't touched for more than |
isActive | boolean | If it's explicitly set to | |
skipKeyboard | boolean | If set to true, the timer is not reset when the keyboard appears or disappears. | |
style | StyleProp | Optional custom style for UserInactivity's View. | |
timeForInactivity | number | Number of milliseconds after which the view is considered inactive. If it changed, the timer restarts and the view is considered active until the new timer expires. |