react-native-battery-monitor
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

react-native-battery-monitor

Battery Monitor for React Native.

npm version

🚀 Getting Started

Prerequisites

  • react-native:
    • supported versions ">= 0.60.0"

Installation

with react-native ">=0.60.0"

1. Install latest version

# Using npm
npm install --save react-native-battery-monitor

# Using Yarn
yarn add react-native-battery-monitor

2. Install pods

$ cd ios && pod install && cd ..

🍰 Example

import BatteryMonitor from 'react-native-battery-monitor';
 
const ubsubscribe = BatteryMonitor.onStateChange((status) => {
  console.log(status.state); //  "unknown" | "unplugged" | "charging" | "full"
  console.log(status.level); // 0.80000001192092
});
 
const batteryState = await BatteryMonitor.getBatteryState();
 
// unsubscribe
ubsubscribe();

Package Sidebar

Install

npm i react-native-battery-monitor

Weekly Downloads

5

Version

0.0.2

License

MIT

Unpacked Size

114 kB

Total Files

33

Last publish

Collaborators

  • tadko