Utilização

Type an image packaged with the app.

tsx
// Type an image packaged with the app.
import { Image, type BundledImageSource } from 'kuito';
import cover from './assets/cover.png';

function Cover(props: { source: BundledImageSource }) {
  // An imported image knows its size, so the view keeps its aspect ratio.
  return (
    <Image src={props.source} width="100%" aspectRatio={props.source.width / props.source.height} />
  );
}

<Cover source={cover} />;

Declaração do tipo

ts
export interface BundledImageSource {
  asset: string;
  width: number;
  height: number;
}

Membros 3

NomeTipoObrigatórioDescrição
assetstringSim—
widthnumberSim—
heightnumberSim—
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.