Utilização

Declare a custom native slider view.

Este tipo é usado por 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' },
});

Declaração do tipo

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;
}

Membros 3

NomeTipoObrigatórioDescrição
eventsreadonly string[]NãoThe events its element hears, by name: change reaches onChange.
methodsRecord<string, unknown>NãoFunctions its element answers, each fn.main; natively they get the mounted view first.
childrenbooleanNãoWhether 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.