ref
Makes a stable ElementRef to a native view while a component sets up; current holds the handle.
Usage
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>
);
}Signatures
<T extends ElementHandle = ElementHandle>(name?: string): ElementRef<T>Type parameters
| Name | Constraint | Default |
|---|---|---|
T | ElementHandle | ElementHandle |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | No | — |
Returns
ElementRef<T>
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.