ViewDeclaration
A view's events and methods, as its spec declares them.
Verwendung
Declare a custom native slider view.
Dieser Typ wird verwendet von 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' },
});Typdeklaration
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;
}Mitglieder 3
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
events | readonly string[] | Nein | The events its element hears, by name: change reaches onChange. |
methods | Record<string, unknown> | Nein | Functions its element answers, each fn.main; natively they get the mounted view first. |
children | boolean | Nein | 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. |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.