app.state
Whether the app is in the foreground. Watched, it follows the platform; starting to observe reports the state the platform starts from, which catches a change made in between.
Utilisation
Refresh on return and release cached data
import { Button, app, watch } from 'kuito';
declare function refresh(): void;
const cache = new Map<string, ArrayBuffer>();
app.state.value; // 'active' | 'background' | 'inactive'
export function Feed() {
// Both follow the platform until the component unmounts.
watch(app.state, (state) => {
if (state === 'active') refresh();
});
app.watch('memoryWarning', () => cache.clear());
return <Button onPress={() => void app.openSettings()}>Open Settings</Button>;
}Propriétés et méthodes 1
| Nom | Type | Requis | Description |
|---|---|---|---|
valuelecture seule | AppState | Oui | — |
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.