@unsw-gsbme/react-native-keep-awake
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

react-native-keep-awake

React Native module for keeping the phone screen alive

based on the work from https://github.com/corbt/react-native-keep-awake

Installation

npm install @unsw-gsbme/react-native-keep-awake
yarn add @unsw-gsbme/react-native-keep-awake

Usage

Class Component style

import { KeepAwake } from '@unsw-gsbme/react-native-keep-awake';

// ...

export default function App() {
  return (
    <View style={styles.container}>
      <Text>Screen will never sleep :)</Text>
      <KeepAwake />
    </View>
  );
}

hooks style

import { useKeepAwake } from '@unsw-gsbme/react-native-keep-awake';

// ...

export default function App() {
  useKeepAwake();
  return (
    <View style={styles.container}>
      <Text>Screen will never sleep :)</Text>
    </View>
  );
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Package Sidebar

Install

npm i @unsw-gsbme/react-native-keep-awake

Weekly Downloads

41

Version

1.0.5

License

MIT

Unpacked Size

892 kB

Total Files

131

Last publish

Collaborators

  • jahead