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

@molecule/app-lifecycle-react-native

v1.0.1

Published

React Native lifecycle provider for molecule.dev (AppState)

Readme

@molecule/app-lifecycle-react-native

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

React Native lifecycle provider for molecule.dev.

Uses react-native AppState + Linking to implement the LifecycleProvider interface from @molecule/app-lifecycle: app-state changes, deep-link URL opens, and memory warnings.

Quick Start

import { setProvider } from '@molecule/app-lifecycle'
import { provider } from '@molecule/app-lifecycle-react-native'

setProvider(provider) // once, at app startup — before any lifecycle call

Type

provider

Installation

npm install @molecule/app-lifecycle-react-native @molecule/app-i18n @molecule/app-lifecycle @molecule/app-logger react-native

API

Interfaces

ReactNativeLifecycleConfig

Configuration for the React Native lifecycle provider.

interface ReactNativeLifecycleConfig {
  /**
   * Whether to track deep link URL open events.
   * @default true
   */
  trackUrlOpen?: boolean

  /**
   * Whether to track memory warnings.
   * @default true
   */
  trackMemoryWarnings?: boolean

  /**
   * URL for active connectivity checks.
   * Should return a fast, lightweight response (e.g. HTTP 204).
   * @default 'https://clients3.google.com/generate_204'
   */
  connectivityCheckUrl?: string

  /**
   * Timeout in milliseconds for connectivity checks.
   * @default 5000
   */
  connectivityCheckTimeout?: number
}

Functions

createReactNativeLifecycleProvider(config)

Creates a React Native lifecycle provider backed by react-native AppState.

function createReactNativeLifecycleProvider(config?: ReactNativeLifecycleConfig): LifecycleProvider
  • config — Optional provider configuration.

Returns: A LifecycleProvider implementation for React Native.

Constants

provider

Default React Native lifecycle provider.

const provider: LifecycleProvider

Core Interface

Implements @molecule/app-lifecycle interface.

Bond Wiring

Setup function to register this provider with the core interface:

import { setProvider } from '@molecule/app-lifecycle'
import { provider } from '@molecule/app-lifecycle-react-native'

export function setupNativeLifecycleReactNative(): void {
  setProvider(provider)
}

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-i18n ^1.0.1
  • @molecule/app-lifecycle ^1.0.1
  • @molecule/app-logger ^1.0.1
  • react-native >=0.72.0

Runtime Dependencies

  • @molecule/app-i18n

  • @molecule/app-lifecycle

  • @molecule/app-logger

  • react-native

  • Wire setProvider() before any lifecycle call. The core lazily bonds a browser-API WEB fallback on first use — subscribe early with no provider bonded and you're on the web provider, not this one.

  • Only app-state, URL-open, and memory-warning events fire. onNetworkChange, onBatteryChange, and onTerminate accept listeners but are NEVER invoked by this bond, and getBatteryState() always resolves null — use @molecule/app-network-react-native for reactive connectivity and a dedicated battery integration (e.g. expo-battery) instead.

  • getNetworkState() performs an active HTTP HEAD probe on every call — by default to https://clients3.google.com/generate_204. Point connectivityCheckUrl at your own endpoint if third-party egress is a concern; connectionType is always 'unknown' here.

  • getLaunchInfo().coldStart is always true; destroy() detaches the native subscriptions.