Socket
Socket
Sign inDemoInstall

react-native-no-sleep

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-no-sleep

Prevents Android and/or iOS device from going to sleep. Comes in a few React.js flavors


Version published
Weekly downloads
14
decreased by-33.33%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Prevents devices from going to sleep due to inactivity. Useful for apps in which users watch the app without interaction, e.g. video or audio apps, games, exercise tools etc.

react-native-no-sleep

The library targets pure React Native projects, with post-0.60 React Native and post-16.8 React with hook support. For expo-based projects, see expo-keep-awake.

Getting started

$ npm install --save react-native-no-sleep

...

Usage

Example 1 - Hook based

import { useNoSleep } from 'react-native-no-sleep';

const GameScreen = () => {
    useNoSleep();

    return (
	  <View>
		<Text>
		  I don't sleep while mounted
		</Text>
	  </View>
    );
};

Example 2 - Render based

import { NoSleep } from 'react-native-no-sleep';

const GameScreen = () => (
    return (
	  <View>
	    <NoSleep />
		<Text>
		  I don't sleep while mounted
		</Text>
	  </View>
    );
};

Keywords

FAQs

Last updated on 27 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc