React Native BatteryStatus (remobile)
A cordova battery status listener for react-native, support for ios and android
Installation
npm install @remobile/react-native-battery-status --save
Installation (iOS)
- Drag RCTBatteryStatus.xcodeproj to your project on Xcode.
- Click on your main project file (the one that represents the .xcodeproj) select Build Phases and drag libRCTBatteryStatus.a from the Products folder inside the RCTBatteryStatus.xcodeproj.
- Look for Header Search Paths and make sure it contains both $(SRCROOT)/../../../react-native/React as recursive.
Installation (Android)
...include ':react-native-battery-status'project(':react-native-battery-status').projectDir = new File(settingsDir, '../node_modules/@remobile/react-native-battery-status/android')
- In
android/app/build.gradle
...dependencies { ... compile project(':react-native-battery-status')}
- register module (in MainApplication.java)
...... // <--- import ...... @Overrideprotected List<ReactPackage> { ...... new RCTBatteryStatusPackage(), // <------ add here ......}
Usage
Example
var React = ;var ReactNative = ;var StyleSheet View Image = ReactNative; var BatteryStatus = ;var Button = ; moduleexports = React; var styles = StyleSheet;
HELP
thanks
- this project come from https://github.com/apache/cordova-plugin-battery-status