ViewDeclaration
A view's events and methods, as its spec declares them.
Usage
Declare a custom native slider view.
This type is used by 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' },
});Type declaration
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;
}Members 3
| Name | Type | Required | Description |
|---|---|---|---|
events | readonly string[] | No | The events its element hears, by name: change reaches onChange. |
methods | Record<string, unknown> | No | Functions its element answers, each fn.main; natively they get the mounted view first. |
children | boolean | No | 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. |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.