A React-Native library to help you detect iOS's low power mode.
$ npm install react-native-low-power-mode --save
$ react-native link react-native-low-power-mode
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-low-power-mode
and addRNLowPowerMode.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNLowPowerMode.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
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
MIT