Verwendung

Declare a custom native slider view.

Dieser Typ wird verwendet von view

tsx
// 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

ts
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

NameTypErforderlichBeschreibung
eventsreadonly string[]NeinThe events its element hears, by name: change reaches onChange.
methodsRecord<string, unknown>NeinFunctions its element answers, each fn.main; natively they get the mounted view first.
childrenbooleanNeinWhether 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.