Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-no-sleep

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

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

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36
increased by28.57%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 27 Jan 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc