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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-nitro-network-info

v1.0.6

Published

A React Native library for monitoring network connectivity status and connection type using Nitro Modules for high performance

Readme

react-native-nitro-network-info

A React Native library for monitoring network connectivity status and connection type using Nitro Modules for high performance.

Features

  • 🚀 High performance with Nitro Modules
  • 📡 Real-time network status monitoring
  • 🔄 Connection type detection (WiFi, Cellular, etc.)
  • 📱 Cross-platform support (iOS & Android)
  • 🎣 React hooks friendly with listeners

Requirements

  • React Native v0.76.0 or higher
  • Node 18.0.0 or higher

Installation

bun add react-native-nitro-network-info [email protected]

Usage

Basic Usage

import React, { useEffect, useState } from 'react';
import { View, Text } from 'react-native';
import NitroNetworkInfo, {
  type NitroNetworkStatusInfo
} from 'react-native-nitro-network-info';

function App() {
  const [networkInfo, setNetworkInfo] = useState<NitroNetworkStatusInfo | null>(null);

  useEffect(() => {
    // Add listener for network changes
    const unsubscribe = NitroNetworkInfo.addListener((networkInfo) => {
      setNetworkInfo(networkInfo);
    });

    // Cleanup listener on unmount
    return () => {
      unsubscribe();
    };
  }, []);

  return (
    <View>
      <Text>
        Status: {NitroNetworkInfo.isConnected ? 'Connected' : 'Disconnected'}
      </Text>
      <Text>
        Type: {NitroNetworkInfo.connectionType || 'Unknown'}
      </Text>
      <Text>
        Network Info: {JSON.stringify(networkInfo, null, 2)}
      </Text>
    </View>
  );
}

API Reference

Properties

isConnected: boolean

A readonly property that indicates whether the device is currently connected to a network.

const isConnected = NitroNetworkInfo.isConnected

connectionType: ConnectionType

A readonly property that returns the current connection type (e.g., 'wifi', 'cellular', 'ethernet', etc.).

const connectionType = NitroNetworkInfo.connectionType

Methods

addListener(listener: NetworkInfoListener): () => void

Adds a listener for network status changes. Returns a function to unsubscribe the listener.

Parameters:

  • listener: NetworkInfoListener - Callback function that receives network status updates

Returns:

  • () => void - Unsubscribe function
const unsubscribe = NitroNetworkInfo.addListener((networkInfo) => {
  console.log('Network status changed:', networkInfo)
})

// Later, when you want to stop listening
unsubscribe()

Types

| Type | Description | | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | NetworkInfoListener | Callback function type that receives network status updates. Signature: (networkInfo: NitroNetworkStatusInfo) => void | | ConnectionType | Enum or string type representing the available connection types (e.g., 'wifi', 'cellular', 'ethernet'). Exact values depend on platform implementation. | | NitroNetworkStatusInfo | Object containing detailed network status information passed to listeners. Structure depends on platform implementation and includes connection state and type details. |

Credits

Bootstrapped with create-nitro-module.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.