react-native-interaction-provider
A behavioral component wrapper detecting user interactions, and letting you know when the application has idled.
Installation
$ npm install react-native-interaction-provider --save
Usage
<InteractionProvider timeout=60 * 1000 // idle after 1m onActive= console onInactive= console> <YourScreen /></InteractionProvider>
Important Note
InteractionProvider
uses the PanResponder
to detect gestures. It will apply the PanHandlers
to the component that it wraps. The wrapped component must apply the provided props to its root View
.
Example:
Component { const props you care about ...rest } = thisprops; return <View ...rest // `panHandlers` will be provided here > ... </View> ; }
Roadmap
context
support for registering specific inactivity rules and callbacks:
{ thissub = thiscontextinteractionProvider} { thissub} { console} { console}