@creedengo/avoid-keep-awake
February 3, 2026 ยท View on GitHub
๐ Avoid screen keep awake.
โ ๏ธ This rule warns in the โ
recommended config.
Why is this an issue?
To avoid draining the battery, an Android device that is left idle quickly falls asleep. Hence, keeping the screen on should be avoided, unless it is absolutely necessary.
Note: This rule currently only supports detecting
expo-keep-awakepackage usage. Support for other keep-awake packages may be added in future versions.
import { useKeepAwake } from "expo-keep-awake";
export default function KeepAwakeExample() {
useKeepAwake(); // Non compliant
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text>This screen will never sleep!</Text>
</View>
);
}
import { activateKeepAwake } from "expo-keep-awake";
_activate = () => {
activateKeepAwake(); // Non-compliant
alert("Activated!");
};
Resources
Documentation
- Expo Docs - Expo KeepAwake