ref
Makes a stable ElementRef to a native view while a component sets up; current holds the handle.
Utilização
Focus a field from an action
import { Button, ref, TextField, VStack } from 'kuito';
function Search() {
const field = ref();
return (
<VStack gap={8}>
<TextField ref={field} placeholder="Search" />
<Button onPress={() => field.current?.focus()}>Search</Button>
</VStack>
);
}Assinaturas
<T extends ElementHandle = ElementHandle>(name?: string): ElementRef<T>Parâmetros de tipo
| Nome | Restrição | Predefinição |
|---|---|---|
T | ElementHandle | ElementHandle |
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
name | string | Não | — |
Devolve
ElementRef<T>
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.