{"id":21540024,"url":"https://github.com/robinpowered/react-native-interaction-provider","last_synced_at":"2025-04-10T03:30:19.563Z","repository":{"id":57337751,"uuid":"93087357","full_name":"robinpowered/react-native-interaction-provider","owner":"robinpowered","description":"Determines if a user is interacting with the application","archived":false,"fork":false,"pushed_at":"2018-04-12T15:07:12.000Z","size":18,"stargazers_count":21,"open_issues_count":4,"forks_count":7,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-10-29T12:57:28.016Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npm.im/react-native-interaction-provider","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robinpowered.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-01T18:26:19.000Z","updated_at":"2021-12-28T18:43:49.000Z","dependencies_parsed_at":"2022-09-14T19:23:19.245Z","dependency_job_id":null,"html_url":"https://github.com/robinpowered/react-native-interaction-provider","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinpowered%2Freact-native-interaction-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinpowered%2Freact-native-interaction-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinpowered%2Freact-native-interaction-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinpowered%2Freact-native-interaction-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robinpowered","download_url":"https://codeload.github.com/robinpowered/react-native-interaction-provider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247847608,"owners_count":21006099,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T04:17:01.851Z","updated_at":"2025-04-10T03:30:19.463Z","avatar_url":"https://github.com/robinpowered.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-interaction-provider\n\nA behavioral component wrapper detecting user interactions, and letting you know when the application has idled.\n\n## Installation\n\n```\n$ npm install react-native-interaction-provider --save\n```\n\n## Usage\n\n```js\nimport InteractionProvider from 'react-native-interaction-provider'\n\n\u003cInteractionProvider\n  timeout={60 * 1000} // idle after 1m\n  onActive={() =\u003e console.log('User no longer idle')}\n  onInactive={() =\u003e console.log('User is idle, dismiss the screen or something')}\n\u003e\n  \u003cYourScreen /\u003e\n\u003c/InteractionProvider\u003e\n```\n\n### Important Note\n\n`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`.\n\nExample:\n\n```js\nclass YourScreen extends React.Component {\n  render() {\n    const {\n      props,\n      you,\n      care,\n      about,\n      ...rest\n    } = this.props;\n    return (\n      \u003cView\n        {...rest} // `panHandlers` will be provided here\n      \u003e\n        ...\n      \u003c/View\u003e\n    );\n  }\n}\n```\n\n## Roadmap\n\n`context` support for registering specific inactivity rules and callbacks:\n\n```js\ncomponentDidMount() {\n  this.sub = this.context.interactionProvider.register(10 * 1000, this.onActive, this.onInactive)\n}\n\ncomponentWillUnmount() {\n  this.sub.remove()\n}\n\nonActive() {\n  console.log('user is active')\n}\n\nonInactive() {\n  console.log('user is inactive after 10s')\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinpowered%2Freact-native-interaction-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobinpowered%2Freact-native-interaction-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinpowered%2Freact-native-interaction-provider/lists"}