AppState
active in the foreground, background when another app or the home
screen is, inactive in between.
Utilização
Refresh on return and release cached data
Este tipo é usado por app.state
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>;
}Declaração do tipo
export type AppState = State;Tipo
"active" | "background" | "inactive"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.