Expo

Documentation

Brightness

An API to get and set screen brightness.

For managed apps, you'll need to run expo install expo-brightness. To use it in a bare React Native app, follow its installation instructions.

import * as Brightness from 'expo-brightness';

Sets screen brightness.

  • brightnessValue (number) -- A number between 0 and 1, representing the desired screen brightness.

Gets screen brightness.

A Promise that is resolved with a number between 0 and 1, representing the current screen brightness.

WARNING: this method is experimental.
Sets global system screen brightness, requires WRITE_SETTINGS permissions on Android.

  • brightnessValue (number) -- A number between 0 and 1, representing the desired screen brightness.

await Permissions.askAsync(Permissions.SYSTEM_BRIGHTNESS);

const { status } = await Permissions.getAsync(Permissions.SYSTEM_BRIGHTNESS);
if (status === 'granted') {
  Brightness.setSystemBrightnessAsync(0.5);
}
...

WARNING: this method is experimental.
Gets global system screen brightness.

A Promise that is resolved with a number between 0 and 1, representing the current system screen brightness.