recommended
config.
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-awake
package 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!");
};
- Expo Docs - Expo KeepAwake