Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-user-inactivity

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-user-inactivity

React Native component that notifies if the user is active or not

  • 0.1.0-next
  • npm
  • Socket score

Version published
Weekly downloads
8.4K
decreased by-6.96%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-user-inactivity

React Native component that notifies if the user is active or not (i.e. when the app surface hasn't been touched for more than a certain amount of ms).

Installation

  • with npm:
npm install --save react-native-user-inactivity
  • with yarn
yarn add react-native-user-inactivity

How to import

import UserInactivity from 'react-native-user-inactivity';

Basic Example

import React, { Component } from 'react';
import { Text } from 'react-native';
import UserInactivity from 'react-native-user-inactivity';

export default class App extends PureComponent {
  state = {
    active: true,
    text: ''
  };

  onAction = (active) => {
    this.setState({
      active,
    });
  }

  render() {
    const { active } = this.state;
    return (
      <UserInactivity
        timeForInactivity={2000}
        onAction={this.onAction}
      >
        <Text style={styles.paragraph}>
          Put your app here: 
          {
            active ? 'Active' : 'Inactive'
          }
        </Text>
      </UserInactivity>
    );
  }
}

Also, please checkout the example on Snack/Expo.

Props

The time is expressed in milliseconds (ms).

PropTypeExplanationRequiredDefault Value
timeForInactivitynumberInactivity time thresholdno10000
onAction(boolean) => voidCallback triggered at every action, or lack of action after timeForInactivity msyes-
stylestyleThe style of the wrapperno{ flex: 1 }
childrenReact.ReactNodeNested react nodes to wrapyes-

Contributing

Of course PRs are welcome!

Keywords

FAQs

Package last updated on 11 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc