network.state
The network now. Watched, it follows each change; the platform monitors only then.
Verwendung
Display an offline hint
import { Text, network } from 'kuito';
network.state.value; // the state now, synchronously
await network.refresh(); // the same, read off the JS thread
function OfflineBanner() {
return <Text>{network.state.value.isInternetReachable ? '' : 'You are offline'}</Text>;
}Eigenschaften und Methoden 1
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
valueschreibgeschützt | NetworkState | Ja | — |
value — verschachtelte Felder
value Felder
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
type | NetworkStateType | Ja | — |
isConnected | boolean | Ja | A network is up. It may still lack internet access, as behind a captive portal. |
isInternetReachable | boolean | Ja | The platform judges the network usable for the internet (docs/network.md). |
details | NetworkDetails | Ja | — |
details — verschachtelte Felder
details Felder
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
isExpensive | boolean | Ja | Traffic may cost the user: cellular, a hotspot, or a network marked metered. |
cellularGeneration | CellularGeneration | Ja | The radio's generation on cellular; null elsewhere or when the platform won't say. |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.