Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-low-power-mode

A React-Native library to help you detect iOS's low power mode.

Getting started

$ npm install react-native-low-power-mode --save

Mostly automatic installation

$ react-native link react-native-low-power-mode

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-low-power-mode and add RNLowPowerMode.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNLowPowerMode.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Usage

import RNLowPowerMode from 'react-native-low-power-mode';

...

componentWillMount() {
    RNLowPowerMode.isLowPowerModeEnabled().then(isLowPower => {
        this.setState({isLowPower});
    });

    RNLowPowerMode.setLowPowerModeListener((isLowPower) => {
        this.setState({isLowPower});
    });
}

componentWillUnmount() {
    RNLowPowerMode.removeLowPowerModeListener();
}

That's it, it's that easy.

Now that you know the device is in low power mode, scale back animations and try to do less processing.

Read more about low power mode HERE

Licence

MIT

About

This module will help your React-Native app know if it's in iOS's low power mode and act accordingly.

Resources

Stars

10 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages