@sigx/lynx-network
v0.4.1
Published
Network connectivity status for sigx-lynx
Maintainers
Readme
@sigx/lynx-network
Network connectivity status for sigx-lynx. NWPathMonitor on iOS, ConnectivityManager on Android.
Install
pnpm add @sigx/lynx-networksigx prebuild auto-discovers and links the native module. No special permissions on either platform.
Usage
import { Network } from '@sigx/lynx-network';
const state = await Network.getState();
if (state.isConnected && state.type === 'wifi') {
// sync large payload
}API
| Method | Notes |
| ------------------------------------- | -------------------------------------------------------------------------------------------------- |
| getState(): Promise<NetworkState> | Single async snapshot — no subscription stream yet. |
| isAvailable(): boolean | Whether the native module is registered in the current build. |
type ConnectionType = 'wifi' | 'cellular' | 'ethernet' | 'bluetooth' | 'none' | 'unknown';
interface NetworkState {
isConnected: boolean;
type: ConnectionType;
isInternetReachable: boolean | null; // null = unknown (e.g. captive portal)
}Gotchas
isInternetReachable: nullmeans the OS hasn't confirmed actual reachability — common on captive-portal Wi-Fi (you're connected to an AP but can't reach the internet without sign-in). Treat as "probably yes".- No subscription API yet. If you need to react to connectivity changes live, poll
getState()from asetIntervalor wrap a small effect — the native publisher exists but isn't surfaced as JS events in this version.
Reference app
examples/lynx-one/my-sigx-app/src/cards/NetworkCard.tsx renders the snapshot and refreshes on tap.
