Utilisation

Type an event emitted by a module view.

tsx
// Type an event emitted by a module view.
import { defineModule, view, type NativeViewEvent } from 'kuito';

// modules/rating/rating.ts: a native star rating view and the event it sends.
export type RatingEvent = NativeViewEvent<'rate', { stars: number }>;

export type RatingProps = {
  stars?: number;
  onRate?: (event: RatingEvent) => void;
};

export default defineModule('Rating', {
  view: view<RatingProps>({ events: ['rate'] }),
  ios: { class: 'RatingModule' },
  android: { class: 'com.example.myapp.modules.rating.RatingModule' },
});

Déclaration du type

ts
export type NativeViewEvent<
  Type extends string,
  Payload = Record<never, never>,
> = KuitoEvent<Type> & Payload;

Membres 3

NomTypeRequisDescription
typeTypeOui—
targetunknownOui—
isTrustedbooleanOui—
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.