@reeq/react-native-device-brightness
v2.0.2
Published
React-Native library which allows you to change devices brightness level
Readme
react-native-device-brightness
React-Native library which allows you to control device brightness
Compatibility
- v1.0.6 — compatible with both the old and the new React Native architectures
- v2.0.0 and above — compatible only with the new architecture
Installation
npm install @reeq/react-native-device-brightnessor
yarn add @reeq/react-native-device-brightnessand
cd ios/
pod installUsage
import {
setBrightnessLevel,
getBrightnessLevel,
useDeviceBrightness,
resetBrightness,
} from '@reeq/react-native-device-brightness';
/**
* setting brightness a required level
* @param level: required
*/
setBrightnessLevel(level: number);
// getting brightness
const brightness = getBrightnessLevel();
// reseting brightness
resetBrightness();
/**
* Hook sets a brightness level, will trigger each time when level is changed.
* It also releases controlling brightness when app goes into inactive/background state
* and restore when it comes back to foreground state.
* This is just a javascript implementation. You may write you own using static methods.
* @param level: required
* @param resetOnUnmount: optional. Default is false.
*/
useDeviceBrightness(level: number, resetOnUnmount?: boolean);Contributing
License
MIT
Made with create-react-native-library
