This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Expo Brightness
A library that provides access to an API for getting and setting the screen brightness.
An API to get and set screen brightness.
On Android, there is a global system-wide brightness setting, and each app has its own brightness setting that can optionally override the global setting. It is possible to set either of these values with this API. On iOS, the system brightness setting cannot be changed programmatically; instead, any changes to the screen brightness will persist until the device is locked or powered off.
Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
Configuration
Are you using this library in an existing React Native app?
If you're not using Continuous Native Generation (CNG) or you're using a native android project manually, then you need to add the android.permission.WRITE_SETTINGS permission to the AndroidManifest.xml file:
Usage
API
import * as Brightness from 'expo-brightness';
No API data file found, sorry!
Error codes
ERR_BRIGHTNESS
An error occurred when getting or setting the app brightness.
ERR_BRIGHTNESS_MODE
An error occurred when getting or setting the system brightness mode. See the nativeError property of the thrown error for more information.
ERR_BRIGHTNESS_PERMISSIONS_DENIED
An attempt to set the system brightness was made without the proper permissions from the user. The user did not grant SYSTEM_BRIGHTNESS permissions.
ERR_BRIGHTNESS_SYSTEM
An error occurred when getting or setting the system brightness.
ERR_INVALID_ARGUMENT
An invalid argument was passed. Only BrightnessMode.MANUAL or BrightnessMode.AUTOMATIC are allowed.
Permissions
Android
You must add the following permissions to your app.json inside the expo.android.permissions array.
iOS
No permissions required.