[component]

Dev Mode
UserInactivity
Description
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.
No demo available for UserInactivity. This component wraps children and detects user inactivity via touch events and keyboard interactions. It is intended to be used at the app root level to trigger actions like session timeouts.
Usage Guidelines
Do
Wrap your app content with UserInactivity at the root level.
Use appropriate timeout values for your use case (e.g., 5-15 minutes for session timeout).
Handle both active and inactive states in your onAction callback.
Don't
Do not nest multiple UserInactivity components.
Do not use very short timeout values that may frustrate users.
Props
Name
Type
Required
Description
children
ReactNode
Required
Children components to embed inside UserInactivity's View. If any children component is pressed,
onAction
Required
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.
Status
Documentation:
Figma:
Web:
iOS:
Android:
Additional Documentation
Original Library
Related
Session Management, Timeout
Examples