React Native · APIs and utilities
Screen
Screen settings.
3 exports
Import
Screen
moduleScreen settings.
| Name | Type | Description |
|---|---|---|
keepAwake | (tag?: string) => Promise<void> | Prevents the screen from dimming. The tag keeps multiple callers from interfering: the screen may dim again once all tags are released. |
allowSleep | (tag?: string) => Promise<void> | Releases a Screen.keepAwake tag. |
isAwake | () => boolean | Whether any tag is keeping the screen awake. |
getBrightness | () => Promise<number> | Brightness (0–1): the value set by the app or the system brightness. |
setBrightness | (value: number) => Promise<void> | Changes the brightness (0–1), e.g. while showing a QR code/ticket. On Android only this app's window; on iOS it is system-wide, so it reverts when the app goes to the background and is reapplied when it returns. |
resetBrightness | () => Promise<void> | Hands brightness back to the system. |
setCaptureProtection | (enabled: boolean) => Promise<void> | Screenshot/recording protection (banking, payment screens). - Android: FLAG_SECURE; screenshots, recordings and the recent apps preview appear black. - iOS: using the secure layer the system uses for password fields, content appears blank in screenshots and recordings; in the app switcher it is hidden by a blurred overlay. Since Apple has no official API it may stop working in a future iOS version; you can still learn about screenshots via addScreenshotListener. |
isCaptureProtected | () => boolean | Whether protection is on. |
isCaptured | () => Promise<boolean> | iOS: whether the screen is being recorded or mirrored. Always false on Android. |
addScreenshotListener | (listener: () => void) => () => void | Called when a screenshot is taken (iOS, Android 14+). Returns a function that ends the subscription. |
addCaptureListener | (listener: (event: { captured: boolean; }) => void) => () => void | Called when screen recording starts/stops (iOS, Android 15+). Called once with the current state on subscribe. |
useKeepAwake
functionKeeps the screen awake while the component is mounted (video, recipe, navigation screen). enabled: false releases it.
useCaptureProtection
functionTurns on screenshot/recording protection while the component is mounted (see Screen.setCaptureProtection).