AccessibilityProps
One set of accessibility props, on every view and on both platforms:
label, hint, role (ARIA's names), live, actions and ARIA's
aria-* state and value facts (see docs/accessibility.md).
Utilização
Make an icon-only button accessible.
// Make an icon-only button accessible.
import { Pressable, Symbol, type AccessibilityProps } from 'kuito';
// An icon button needs words for a screen reader: callers pass them through.
function IconButton(props: AccessibilityProps & { icon: string; onPress: () => void }) {
return (
<Pressable role="button" label={props.label} hint={props.hint} onPress={props.onPress}>
<Symbol name={props.icon} size={22} />
</Pressable>
);
}
<IconButton icon="heart" label="Like" hint="Adds the song to your likes" onPress={() => {}} />;Declaração do tipo
export interface AccessibilityProps extends AccessibilityNativeProps {
role?: Prop<Role>;
/** The screen reader action taken, by `name`. */
onAction?: (event: AccessibilityActionEvent) => void;
}Membros 17
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
role | Prop<Role> | Não | — |
onAction | (event: AccessibilityActionEvent) => void | Não | The screen reader action taken, by name. |
accessible | Prop<boolean> | Não | Makes the view one screen reader element, read as its label or its children's text. |
label | Prop<string> | Não | What a screen reader says for the view. |
hint | Prop<string> | Não | What happens when the view is activated, read after the label. |
actions | Prop<readonly AccessibilityAction[]> | Não | Actions a screen reader offers; onAction receives the one taken. |
live | Prop<"off" | "polite" | "assertive"> | Não | ARIA's aria-live: announces changes to the view's content, on iOS too. |
aria-disabled | Prop<boolean> | Não | — |
aria-selected | Prop<boolean> | Não | — |
aria-checked | Prop<boolean | "mixed"> | Não | — |
aria-busy | Prop<boolean> | Não | — |
aria-expanded | Prop<boolean> | Não | — |
aria-valuemin | Prop<number> | Não | — |
aria-valuemax | Prop<number> | Não | — |
aria-valuenow | Prop<number> | Não | — |
aria-valuetext | Prop<string> | Não | — |
onAction — assinaturas de método
Assinaturas
(event: AccessibilityActionEvent): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
event | AccessibilityActionEvent | Sim | — |
Devolve
void
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.