An open API service indexing awesome lists of open source software.

https://github.com/reeq-dev/react-native-device-brightness

React-Native library which allows you to change devices brightness level
https://github.com/reeq-dev/react-native-device-brightness

android ios react-native

Last synced: 6 months ago
JSON representation

React-Native library which allows you to change devices brightness level

Awesome Lists containing this project

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

```sh
npm install @reeq/react-native-device-brightness
```

or

```sh
yarn add @reeq/react-native-device-brightness
```

and

```sh
cd ios/
pod install
```

## Usage

```js
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

- [Development workflow](CONTRIBUTING.md#development-workflow)
- [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
- [Code of conduct](CODE_OF_CONDUCT.md)

## License

MIT

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
```