unsw-gsbme / react-native-keep-awake

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

License:MIT License


Languages

Language:Java 35.0%Language:Objective-C 19.2%Language:TypeScript 18.1%Language:Kotlin 8.3%Language:JavaScript 8.2%Language:Ruby 6.6%Language:Swift 3.2%Language:Shell 0.7%Language:C 0.6%