react-native-screen-awake
v0.1.1
Published
A lightweight React Native native module that prevents the screen from sleeping on iOS and Android.
Downloads
84
Maintainers
Readme
react-native-screen-awake
A lightweight React Native native module that prevents the screen from sleeping on iOS and Android.
On Android, the module supports both the Old Architecture and the New Architecture (TurboModules). On iOS, it works only with the New Architecture.
Installation
npm install react-native-screen-awakeor
yarn install react-native-screen-awakethen
cd ios && pod installUsage
import { activate, deactivate } from 'react-native-screen-awake';
import { useEffect } from 'react';
export function MyScreen() {
useEffect(() => {
activate();
return () => deactivate();
}, []);
return null;
}Behavior
iOS: sets UIApplication.shared.idleTimerDisabled = true
Android: adds FLAG_KEEP_SCREEN_ON to the current Activity window
Manual screen lock (power button) is not prevented — this is expected OS behavior
Platforms
iOS ✅
Android ✅
Contributing
License
MIT
Made with create-react-native-library
