network.state
The network now. Watched, it follows each change; the platform monitors only then.
Utilização
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>;
}Propriedades e métodos 1
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
valuesó de leitura | NetworkState | Sim | — |
value — campos aninhados
value campos
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
type | NetworkStateType | Sim | — |
isConnected | boolean | Sim | A network is up. It may still lack internet access, as behind a captive portal. |
isInternetReachable | boolean | Sim | The platform judges the network usable for the internet (docs/network.md). |
details | NetworkDetails | Sim | — |
details — campos aninhados
details campos
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
isExpensive | boolean | Sim | Traffic may cost the user: cellular, a hotspot, or a network marked metered. |
cellularGeneration | CellularGeneration | Sim | The radio's generation on cellular; null elsewhere or when the platform won't say. |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.