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

@onekeyfe/react-native-network-info

v6.7.0-56

Published

react-native-network-info

Readme

@onekeyfe/react-native-network-info

Read-only network and Wi-Fi information for React Native on iOS and Android.

npm license iOS Android TurboModule

A TurboModule that exposes the device's current network addresses and Wi-Fi details through promise-based getters: IP, IPv4, IPv6, Wi-Fi IPv4, gateway, subnet, broadcast, SSID, BSSID and channel frequency. It reads OS state and nothing more — it opens no connection, monitors no reachability and emits no network-change events. Availability depends on the platform, the active network and permission state, so callers must treat nullable values and rejections as normal outcomes.

Features

  • Separate address readings — full IP, IPv4, IPv6, Wi-Fi IPv4, gateway and subnet getters instead of one ambiguous "IP" value.
  • Wi-Fi detail — getSSID, getBSSID, getBroadcast and getFrequency return the current interface state when the OS allows reading it.
  • Null over guessing — Wi-Fi names and frequency resolve null when the OS withholds them, rather than a sentinel string.
  • No side effects — no socket, no request, no camera and no view mount; each call is a single native query.
  • Mac Catalyst compatible — the IPv4 gateway helper compiles against the Catalyst SDK's routing structures.

Installation

yarn add @onekeyfe/react-native-network-info

The package ships native code. Install the application's iOS pods and rebuild the native binary; a JavaScript-only update does not register the TurboModule. Declare the platform permissions your consumer needs — reading Wi-Fi names on both platforms requires location permission and enabled location services, and the application owns those declarations and their user-facing explanation.

Usage

import { NetworkInfo } from '@onekeyfe/react-native-network-info';

const ipAddress = await NetworkInfo.getIPAddress();
const gateway = await NetworkInfo.getGatewayIPAddress();
const ssid = await NetworkInfo.getSSID(); // string or null

if (ssid === null) {
  // Wi-Fi name unavailable: no Wi-Fi, or location permission/state missing.
}

Refresh the values yourself when needed; the module holds no cache and offers no change callback.

API

| Method | Result | Platforms | Description | | --- | --- | :-: | --- | | getIPAddress() / getIPV4Address() / getIPV6Address() | Promise<string> | iOS, Android | Active interface, IPv4 and IPv6 addresses. | | getWIFIIPV4Address() | Promise<string> | iOS, Android | Wi-Fi interface IPv4 address. | | getGatewayIPAddress() / getSubnet() | Promise<string> | iOS, Android | Default gateway and subnet mask. | | getBroadcast() | Promise<string \| null> | iOS, Android | Broadcast address, when known. | | getSSID() | Promise<string \| null> | iOS, Android | Current Wi-Fi network name. | | getBSSID() | Promise<string \| null> | iOS, Android | Current Wi-Fi access point BSSID. | | getFrequency() | Promise<number \| null> | iOS, Android | Current Wi-Fi channel frequency. | | NetworkInfoSpec | type | iOS, Android | The native module interface type. |

The package exports the native object as NetworkInfo and its interface as NetworkInfoSpec. There is no network-change event API or continuous reachability monitor: the application owns refresh frequency and interpretation. See src/NativeNetworkInfo.ts for exact signatures.

Platform support

| Capability | iOS | Android | Web | | --- | :-: | :-: | :-: | | IP / IPv4 / IPv6 / Wi-Fi IPv4 addresses | ✅ | ✅ | — | | Gateway, subnet and broadcast | ✅ | ✅ | — | | SSID / BSSID | ✅ with location permission | ✅ with location permission | — | | Channel frequency | ✅ | ✅ | — |

Mac Catalyst builds support the IPv4 gateway helper; the package's Web implementation is not provided.

Caveats

[!NOTE] A null SSID, BSSID, broadcast or frequency is a valid reading, not an error. Keep it distinct from a known value and do not substitute an empty string.

[!WARNING] Address getters resolve a value instead of rejecting when unavailable: iOS returns "" from getIPAddress and "0.0.0.0" from getIPV4Address / getWIFIIPV4Address, and Android may resolve null despite the Promise<string> type. Validate the value before use. The module neither connects nor checks reachability, and an address or SSID is not evidence of Internet access: validate connectivity separately and re-read after network changes.

[!IMPORTANT] Wi-Fi names require location permission and enabled location services on both platforms. Without them the guarded getters resolve null; the application owns the permission request and its explanation.

References

Upstream attribution

First, a sincere thank-you to the react-native-network-info maintainers for their excellent work 🙏

This package is built on, and inspired by, pusherman/react-native-network-info.

Our original plan was to keep our customizations as patches on top of upstream react-native-network-info.

As our product requirements evolved, the scope of those changes outgrew what we could reasonably maintain as an upstream patch set. We regret that we were unable to keep this work in patch form.

As the gap grew, we ultimately forked react-native-network-info to keep development and delivery stable.

Upstream Project

Notes

  • This fork includes OneKey-specific adaptations for our product requirements.
  • If you are looking for original behavior and full documentation, please refer to the upstream repository.

Thank you again to everyone who contributes to react-native-network-info 💙

License

MIT. See LICENSE.