npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@thehale/react-native-keep-awake

v0.2.0

Published

Prevent the phone screen from going to sleep.

Readme

@thehale/react-native-keep-awake

Prevent the phone screen from going to sleep.

Joseph Hale's software engineering blog

Installation

npm install @thehale/react-native-keep-awake

Compatibility

React Native 0.78.0+ (New Architecture only)

Usage

There are three different ways you can use this library to keep a screen from going to sleep.

Add a Component

Any screen that includes the KeepAwake component in its tree will not go to sleep.

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

function MyScreen() {
    return (
        <View>
            <KeepAwake />
            <Text>This screen won't go to sleep!</Text>
        </View>
    )
}

Use a Hook

Invoking the useKeepAwake hook will prevent that screen from going to sleep.

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

function MyScreen() {
    useKeepAwake()
    return (
        <View>
            <Text>This screen won't go to sleep!</Text>
        </View>
    )
}

Manual Control

import { activate, deactivate } from '@thehale/react-native-keep-awake';

function MyScreen() {
    return (
        <View>
            <Text>Press this button to block the screen from going to sleep</Text>
            <Button title="Activate" onPress={activate} />
            
            <Text>Press this button to allow the screen to sleep/lock</Text>
            <Button title="Deactivate" onPress={deactivate} />
        </View>
    )
}

Contributing

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

License

Copyright (c) 2025 Joseph Hale, All Rights Reserved

Provided under the terms of the Mozilla Public License, version 2.0

[!NOTE] This package is a rewrite of react-native-keep-awake and @sayem314/react-native-keep-awake which are licensed under the MIT license.

TL;DR

You can use files from this project in both open source and proprietary applications, provided you include the above attribution. However, if you modify any code in this project, or copy blocks of it into your own code, you must publicly share the resulting files (note, not your whole program) under the MPL-2.0. The best way to do this is via a Pull Request back into this project.

If you have any other questions, you may also find Mozilla's official FAQ for the MPL-2.0 license insightful.

If you dislike this license, you can contact me about negotiating a paid contract with different terms.

Disclaimer: This TL;DR is just a summary. All legal questions regarding usage of this project must be handled according to the official terms specified in the LICENSE file.

Why the MPL-2.0 license?

I believe that an open-source software license should ensure that code can be used everywhere.

Strict copyleft licenses, like the GPL family of licenses, fail to fulfill that vision because they only permit code to be used in other GPL-licensed projects. Permissive licenses, like the MIT and Apache licenses, allow code to be used everywhere but fail to prevent proprietary or GPL-licensed projects from limiting access to any improvements they make.

In contrast, the MPL-2.0 license allows code to be used in any software project, while ensuring that any improvements remain available for everyone.


Made with create-react-native-library