Image
Die Übersetzung dieser Seite fehlt oder ist veraltet, daher wird sie auf Englisch angezeigt. Auf Englisch lesen
Display a bundled, remote or local-file image. Use it for avatars, covers and photos returned by the picker or camera.
Load a cover without a blank flash
import { Image } from 'kuito';
export default function Cover() {
return (
<Image
src="https://example.com/cover.jpg"
width={160}
aspectRatio={1}
borderRadius={8}
placeholder="#1e293b"
fadeDuration={250}
/>
);
}Behavior
Give the image dimensions or an aspect ratio so layout can reserve space before download. placeholder fills the waiting area and fadeDuration controls its reveal. Remote images use native caching; image.prefetch warms the cache.
Props
| Prop | Meaning |
|---|---|
src |
A URL string, { uri, headers? }, or an imported image (assets). |
objectFit |
CSS's object-fit: cover (default), contain, fill or none. |
tintColor |
Recolors opaque pixels, for icons. |
onLoadStart / onLoadEnd |
Around every load, success or failure. |
onLoad |
{ width, height } of the image in pixels. |
onError |
{ error }, e.g. "HTTP 404". |
aspectRatio (Kuito) |
Width ÷ height: sizes the view before the image arrives. |
placeholder (Kuito) |
Color shown while loading. |
thumbhash (Kuito) |
A base64 ThumbHash: its blurred preview shows while loading, over placeholder. |
fadeDuration (Kuito) |
Cross-fade in milliseconds when the image appears; 0 by default. |
cache (Kuito) |
memory-disk (default), memory, disk or none. |
Continue
Read Assets for a complete workflow. See the complete prop reference for types and documented defaults.
Referenz
Signaturen
(props: ImageProps): KuitoElementParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
props | ImageProps | Ja | — |
Rückgabe
Props: ImageProps
Props (einschließlich geerbter Props) 96
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
onLoadStart | (event: KuitoEvent<"loadstart">) => void | Nein | — |
onLoad | (event: ImageLoadEvent) => void | Nein | — |
onError | (event: ImageErrorEvent) => void | Nein | — |
onLoadEnd | (event: KuitoEvent<"loadend">) => void | Nein | — |
id | string | Nein | — |
ref | ElementRef<ElementHandle> | Nein | — |
class | Prop<ClassNames> | Nein | Class names from a .css import or styles(): a string, or a list with falsy entries skipped, following the signals it reads. |
style | StyleDeclarations | Nein | Styles of this view alone, compiled at build time: CSS properties in
camelCase. A value that changes must set a native prop (opacity). |
onPress | (event: PressEvent) => void | Nein | — |
onPressCapture | (event: PressEvent) => void | Nein | — |
key | string | number | Nein | — |
padding | Prop<LengthPercentage> | Nein | — |
paddingTop | Prop<LengthPercentage> | Nein | — |
paddingRight | Prop<LengthPercentage> | Nein | — |
paddingBottom | Prop<LengthPercentage> | Nein | — |
paddingLeft | Prop<LengthPercentage> | Nein | — |
width | Animatable<SizeValue> | Nein | — |
height | Animatable<SizeValue> | Nein | — |
minWidth | Prop<SizeValue> | Nein | — |
maxWidth | Prop<SizeValue> | Nein | — |
minHeight | Prop<SizeValue> | Nein | — |
maxHeight | Prop<SizeValue> | Nein | — |
aspectRatio | Prop<number> | Nein | Width divided by height; sizes the missing side from the other. |
position | Prop<"relative" | "absolute"> | Nein | — |
top | Prop<LengthPercentageAuto> | Nein | — |
right | Prop<LengthPercentageAuto> | Nein | — |
bottom | Prop<LengthPercentageAuto> | Nein | — |
left | Prop<LengthPercentageAuto> | Nein | — |
margin | Prop<LengthPercentageAuto> | Nein | — |
marginTop | Prop<LengthPercentageAuto> | Nein | — |
marginRight | Prop<LengthPercentageAuto> | Nein | — |
marginBottom | Prop<LengthPercentageAuto> | Nein | — |
marginLeft | Prop<LengthPercentageAuto> | Nein | — |
flexGrow | Prop<number> | Nein | — |
flexShrink | Prop<number> | Nein | — |
flexBasis | Prop<SizeValue | "content"> | Nein | — |
flex | Prop<number> | Nein | A grow factor from a zero basis, as CSS flex: n; 0 is inflexible. |
alignSelf | Prop<"auto" | SelfAlignment> | Nein | — |
direction | Prop<"ltr" | "rtl"> | Nein | The way lines run; unset, the parent's, and the app's first language's at the root. |
boxSizing | Prop<"border-box" | "content-box"> | Nein | — |
paddingInlineStart | Prop<LengthPercentage> | Nein | Padding on the side lines start from: the left in ltr, the right in rtl. |
paddingInlineEnd | Prop<LengthPercentage> | Nein | Padding on the side lines end at: the right in ltr, the left in rtl. |
marginInlineStart | Prop<LengthPercentageAuto> | Nein | Margin on the side lines start from: the left in ltr, the right in rtl. |
marginInlineEnd | Prop<LengthPercentageAuto> | Nein | Margin on the side lines end at: the right in ltr, the left in rtl. |
insetInlineStart | Prop<LengthPercentageAuto> | Nein | left in ltr, right in rtl. |
insetInlineEnd | Prop<LengthPercentageAuto> | Nein | right in ltr, left in rtl. |
role | Prop<Role> | Nein | — |
onAction | (event: AccessibilityActionEvent) => void | Nein | The screen reader action taken, by name. |
accessible | Prop<boolean> | Nein | Makes the view one screen reader element, read as its label or its children's text. |
label | Prop<string> | Nein | What a screen reader says for the view. |
hint | Prop<string> | Nein | What happens when the view is activated, read after the label. |
actions | Prop<readonly AccessibilityAction[]> | Nein | Actions a screen reader offers; onAction receives the one taken. |
live | Prop<"off" | "polite" | "assertive"> | Nein | ARIA's aria-live: announces changes to the view's content, on iOS too. |
aria-disabled | Prop<boolean> | Nein | — |
aria-selected | Prop<boolean> | Nein | — |
aria-checked | Prop<boolean | "mixed"> | Nein | — |
aria-busy | Prop<boolean> | Nein | — |
aria-expanded | Prop<boolean> | Nein | — |
aria-valuemin | Prop<number> | Nein | — |
aria-valuemax | Prop<number> | Nein | — |
aria-valuenow | Prop<number> | Nein | — |
aria-valuetext | Prop<string> | Nein | — |
gestures | readonly Composable[] | Nein | The view's gestures; several race unless composed with together or orElse. |
opacity | Animatable<number> | Nein | — |
backgroundColor | Animatable<string> | Nein | — |
translateX | Animatable<number> | Nein | — |
translateY | Animatable<number> | Nein | — |
scale | Animatable<number> | Nein | — |
scaleX | Animatable<number> | Nein | — |
scaleY | Animatable<number> | Nein | — |
rotate | Animatable<number> | Nein | Degrees. |
transition | Partial<Record<"opacity" | "backgroundColor" | "transform" | "borderRadius" | "borderColor" | "shadow" | "width" | "height" | "all", Animation<unknown> | AnimationSpec>> | Nein | How the animatable props move when they change, enter or leave, by group; a CSS transition compiles to it. |
animate | Partial<Record<AnimatableProps, string | number>> | Nein | Animatable props whose every change moves as transition says; the first value applies at once. |
enter | Effect | Nein | Where the view enters from: fade.and(slide.up(12)). |
exit | Prop<Effect> | Nein | Where the view leaves to; it stays on screen until it is there. The renderer gets true, and keeps the view until exited. |
layout | Animation<number> | Nein | How the view moves to a new frame the layout gives it: layout={spring()}. |
borderRadius | Animatable<number> | Nein | — |
overflow | Prop<"visible" | "hidden" | "clip" | "scroll"> | Nein | hidden and scroll clip; as in CSS, either lets a flex item shrink below its content. |
borderWidth | Prop<number> | Nein | — |
borderColor | Animatable<string> | Nein | — |
shadowColor | Animatable<string> | Nein | — |
shadowRadius | Animatable<number> | Nein | — |
shadowOffsetX | Animatable<number> | Nein | — |
shadowOffsetY | Animatable<number> | Nein | — |
backgroundGradient | { angle: number; colors: string[];} | Nein | — |
color | Prop<string> | Nein | — |
sharedId | Prop<string> | Nein | A view the navigation stack flies to the view with the same sharedId on the screen it pushes or pops to (docs/navigation.md#shared-elements). |
src | Prop<ImageSource> | Nein | A URL, or a bundled image as its import gives it. |
objectFit | Prop<"none" | "cover" | "contain" | "fill"> | Nein | CSS's object-fit: cover fills and crops, contain fits, fill distorts, none keeps its size, centered. |
placeholder | Prop<string> | Nein | Color shown while the image loads. |
fadeDuration | Prop<number> | Nein | Cross-fade duration in milliseconds when the image appears; 0 by default. |
tintColor | Prop<string> | Nein | Recolors the image's opaque pixels, for icons. |
cache | Prop<"none" | "memory-disk" | "memory" | "disk"> | Nein | Which caches may serve and keep the image; memory-disk by default. |
thumbhash | Prop<string> | Nein | A ThumbHash of the image, in base64: its blurred preview shows, over placeholder, until the image loads. |
onLoadStart — Methodensignaturen
Signaturen
(event: KuitoEvent<"loadstart">): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | KuitoEvent<"loadstart"> | Ja | — |
Rückgabe
void
onLoad — Methodensignaturen
Signaturen
(event: ImageLoadEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | ImageLoadEvent | Ja | — |
Rückgabe
void
onError — Methodensignaturen
Signaturen
(event: ImageErrorEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | ImageErrorEvent | Ja | — |
Rückgabe
void
onLoadEnd — Methodensignaturen
Signaturen
(event: KuitoEvent<"loadend">): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | KuitoEvent<"loadend"> | Ja | — |
Rückgabe
void
onPress — Methodensignaturen
Signaturen
onPressCapture — Methodensignaturen
Signaturen
onAction — Methodensignaturen
Signaturen
(event: AccessibilityActionEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | AccessibilityActionEvent | Ja | — |
Rückgabe
void
backgroundGradient — verschachtelte Felder
backgroundGradient Felder
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
angle | number | Ja | — |
colors | string[] | Ja | — |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.