network.state
The network now. Watched, it follows each change; the platform monitors only then.
Utilisation
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>;
}Propriétés et méthodes 1
| Nom | Type | Requis | Description |
|---|---|---|---|
valuelecture seule | NetworkState | Oui | — |
value — champs imbriqués
value champs
| Nom | Type | Requis | Description |
|---|---|---|---|
type | NetworkStateType | Oui | — |
isConnected | boolean | Oui | A network is up. It may still lack internet access, as behind a captive portal. |
isInternetReachable | boolean | Oui | The platform judges the network usable for the internet (docs/network.md). |
details | NetworkDetails | Oui | — |
details — champs imbriqués
details champs
| Nom | Type | Requis | Description |
|---|---|---|---|
isExpensive | boolean | Oui | Traffic may cost the user: cellular, a hotspot, or a network marked metered. |
cellularGeneration | CellularGeneration | Oui | The radio's generation on cellular; null elsewhere or when the platform won't say. |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.