@sayem314/react-native-keep-awake
Advanced tools
Comparing version 1.0.1 to 1.0.2
23
index.js
@@ -1,26 +0,11 @@ | ||
import React, { useEffect } from "react"; | ||
import { NativeModules } from "react-native"; | ||
import React from "react"; | ||
export function useKeepAwake() { | ||
useEffect(() => { | ||
NativeModules.KCKeepAwake.activate(); | ||
return () => NativeModules.KCKeepAwake.deactivate(); | ||
}, []); | ||
} | ||
export function useKeepAwake() {} | ||
export function activateKeepAwake() { | ||
NativeModules.KCKeepAwake.activate(); | ||
} | ||
export function activateKeepAwake() {} | ||
export function deactivateKeepAwake() { | ||
NativeModules.KCKeepAwake.deactivate(); | ||
} | ||
export function deactivateKeepAwake() {} | ||
export default function KeepAwake() { | ||
useEffect(() => { | ||
NativeModules.KCKeepAwake.activate(); | ||
return () => NativeModules.KCKeepAwake.deactivate(); | ||
}, []); | ||
return null; | ||
} |
{ | ||
"name": "@sayem314/react-native-keep-awake", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Keep the screen from going to sleep. iOS, Android and Web.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,3 +15,3 @@ This React Native package allows you to prevent the screen from going to sleep while your app is active. It's useful for things like navigation or video playback, where the user expects the app to remain visible over long periods without touch interaction. | ||
```jsx | ||
```js | ||
import { useKeepAwake } from '@sayem314/react-native-keep-awake'; | ||
@@ -34,3 +34,3 @@ import React from 'react'; | ||
```jsx | ||
```js | ||
import KeepAwake from '@sayem314/react-native-keep-awake'; | ||
@@ -52,6 +52,6 @@ import React from 'react'; | ||
```jsc | ||
import { activateKeepAwake, deactivateKeepAwake } from '@sayem314/react-native-keep-awake'; | ||
import React from 'react'; | ||
import { Button, View } from 'react-native'; | ||
```js | ||
import { activateKeepAwake, deactivateKeepAwake} from "@sayem314/react-native-keep-awake"; | ||
import React from "react"; | ||
import { Button, View } from "react-native"; | ||
@@ -61,3 +61,3 @@ export default class KeepAwakeExample extends React.Component { | ||
return ( | ||
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> | ||
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}> | ||
<Button onPress={this._activate}>Activate</Button> | ||
@@ -71,8 +71,8 @@ <Button onPress={this._deactivate}>Deactivate</Button> | ||
activateKeepAwake(); | ||
}; | ||
}; | ||
_deactivate = () => { | ||
deactivateKeepAwake(); | ||
}; | ||
}; | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25720
17
68