New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

react-native-device-monitor

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-device-monitor

Monitor Device State

2.0.0
latest
Version published
Weekly downloads
8
Maintainers
2
Weekly downloads
 
Created

React Native Device Monitor

Monitor device state in a react-native app without boilerplate.
npm install --save react-native-device-monitor

Basic Usage

render() {
  return (
    <DeviceMonitor
      onAppState={this.setAppState}
      onKeyboard={this.setKeyboardStatus}
      onNetInfo={this.setNetInfo}
      onConnectivityChange={this.setConnectivity}
      onViewport={this.setViewport}
      >
      <RestOfTheApp />
    </DeviceMonitor>
  )
}

API

onAppState function (appState)

  • appState: enum('active', 'background', 'inactive')

onKeyboard function (status, layout)

  • status: bool
  • layout: {width, height}

onNetInfo function (reach)

  • reach: enum('none', 'wifi', 'cell', 'unknown')

onConnectivityChange function (status)

  • status: bool

onViewport function (viewport)

  • viewport: {width, height}

Exact response shape may depend on your version of react-native. Return values are unmodified, as such it can be helpful to reference the official docs.

FAQs

Package last updated on 25 Oct 2017

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