Skip to content

Commit

Permalink
Add avoid-keep-awake asciidoc and json
Browse files Browse the repository at this point in the history
  • Loading branch information
DESKTOP-J99B7TH\Gilbert authored and utarwyn committed Jun 11, 2024
1 parent 98aac72 commit e734aab
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
:!sectids:

== 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.

== Example of non compliant code

```js
export default function KeepAwakeExample() {
useKeepAwake(); // Non compliant
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>This screen will never sleep!</Text>
</View>
);
}
```

```js
_activate = () => {
activateKeepAwake(); // Non-compliant
alert('Activated!');
};
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"tags": [
"sobriety",
"environment",
"ecocode",
"react-native",
"eco-design"
],
"compatibleLanguages": [
"JAVASCRIPT",
"TYPESCRIPT"
]
}

0 comments on commit e734aab

Please sign in to comment.