ViewDeclaration
A view's events and methods, as its spec declares them.
Utilização
Declare a custom native slider view.
Este tipo é usado por view
// Declare a custom native slider view.
import { defineModule, view } from 'kuito';
type SliderProps = {
value: number;
min?: number;
max?: number;
onChange?: (value: number) => void;
};
export default defineModule('Slider', {
view: view<SliderProps>({ events: ['change'] }),
ios: { class: 'KuitoSliderModule' },
android: { class: 'dev.kuito.runtime.modules.slider.KuitoSliderModule' },
});Declaração do tipo
export interface ViewDeclaration {
/** The events its element hears, by name: `change` reaches `onChange`. */
events?: readonly string[];
/** Functions its element answers, each `fn.main`; natively they get the mounted view first. */
methods?: Record<string, unknown>;
/**
* Whether it lays out children inside it, as a container does: its props
* type declares `children` too. A view that doesn't declare it is a leaf.
*/
children?: boolean;
}Membros 3
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
events | readonly string[] | Não | The events its element hears, by name: change reaches onChange. |
methods | Record<string, unknown> | Não | Functions its element answers, each fn.main; natively they get the mounted view first. |
children | boolean | Não | Whether it lays out children inside it, as a container does: its props
type declares children too. A view that doesn't declare it is a leaf. |
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.