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

@better-native/network

v0.0.1-alpha.1

Published

Effect-native network state for Expo applications.

Readme

@better-native/network

Effect-native network state with an Expo-compatible entrypoint.

The package has two public boundaries:

  • @better-native/network provides typed Effects, a scoped Stream, an Effect Atom, and a replaceable service;
  • @better-native/network/expo preserves the expo-network import surface for incremental migration.

See Expo's Network documentation for native platform behavior and permissions. This guide covers the Better Native boundary; API mapping and host tests alone are not native-parity evidence.

Installation

Install the native provider, this package, and its Effect peer in one Expo CLI transaction:

npx expo install expo-network @better-native/network@alpha [email protected]

Expo selects the expo-network version compatible with the application's SDK. The Better Native and Effect specifications remain explicit because Expo does not version those third-party packages. Rebuild the native application after changing native dependencies. Expo automatically adds the Android network- and Wi-Fi-state permissions required by the module.

Effect API

import { Network } from "@better-native/network"
import * as Effect from "effect/Effect"

const currentState = Network.getNetworkStateAsync.pipe(Effect.provide(Network.live))

The live layer validates the state returned by Expo. An unavailable native operation fails with NetworkUnavailable; native rejection or invalid state data fails with NetworkFailure, retaining the method and original cause.

getIpAddressAsync and isAirplaneModeEnabledAsync use the same error channel. Airplane-mode inspection is an Android-only Expo capability, so consumers must handle unavailability rather than assuming it works on every platform.

Changes and React

addNetworkStateListener is a Stream. Its native subscription is removed when the Stream scope closes:

import { Network } from "@better-native/network"
import * as Effect from "effect/Effect"
import * as Stream from "effect/Stream"

const firstChange = Network.addNetworkStateListener.pipe(
  Stream.take(1),
  Stream.runCollect,
  Effect.provide(Network.live),
)

networkStateAtom combines the initial read with subsequent events for React consumers using @effect/atom-react. It exposes Effect's asynchronous result state instead of hiding native or decoding failures.

Expo-compatible import

For a low-churn migration, change only the module specifier:

import { useNetworkState } from "@better-native/network/expo"

The /expo entrypoint delegates to expo-network and retains its Promise, callback, and hook behavior. Import from the package root when opting into Effects, Streams, and typed failures.

Evidence boundary

The compatibility ownership ledger classifies Network as effect. Paired Release comparisons pass the reviewed Effect reads, typed native unavailability, Stream lifecycle, and Atom hydration on iOS, Android, and web with zero divergences. Expo remains the native capability provider behind Network.live. Use bun run coverage to inspect exact API mappings.