UNPKG

2.8 kBTypeScriptView Raw
1import { View } from '../core/view';
2import { Style } from '../styling/style';
3import { ImageSource } from '../../image-source';
4import { ImageAsset } from '../../image-asset';
5import { Color } from '../../color';
6import { Property, InheritedCssProperty } from '../core/properties';
7import { CoreTypes } from '../../core-types';
8
9export { ImageSymbolEffect, ImageSymbolEffects } from './image-common';
10/**
11 * Represents a class that provides functionality for loading and streching image(s).
12 */
13export class Image extends View {
14 /**
15 * Gets the native [android widget](http://developer.android.com/reference/android/widget/ImageView.html) that represents the user interface for this component. Valid only when running on Android OS.
16 */
17 android: any /* android.widget.ImageView */;
18
19 /**
20 * Gets the native iOS [UIImageView](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImageView_Class/) that represents the user interface for this component. Valid only when running on iOS.
21 */
22 ios: any /* UIImageView */;
23
24 /**
25 * Gets or sets the image source of the image.
26 */
27 imageSource: ImageSource;
28
29 /**
30 * Gets or sets the source of the Image. This can be either an URL string or a native image instance.
31 */
32 src: string | ImageSource | ImageAsset;
33
34 /**
35 * Gets a value indicating if the image is currently loading.
36 */
37 readonly isLoading: boolean;
38
39 /**
40 * Gets or sets the image stretch mode.
41 */
42 stretch: CoreTypes.ImageStretchType;
43
44 /**
45 * Gets or sets the loading strategy for images on the local file system:
46 * - **sync** - blocks the UI if necessary to display immediately, good for small icons.
47 * - **async** *(default)* - will load in the background, may appear with short delay, good for large images.
48 * When loading images from web they are always loaded **async** no matter of loadMode value.
49 */
50 loadMode: 'sync' | 'async';
51
52 /**
53 * A color used to tint template images.
54 */
55 tintColor: Color;
56
57 /**
58 * Gets or sets the desired decode height of the image.
59 * This property is Android specific.
60 */
61 decodeHeight: CoreTypes.LengthType;
62
63 /**
64 * Gets or sets the desired decode width of the image.
65 * This property is Android specific.
66 */
67 decodeWidth: CoreTypes.LengthType;
68}
69
70export const imageSourceProperty: Property<Image, ImageSource>;
71export const srcProperty: Property<Image, string | ImageSource | ImageAsset>;
72export const isLoadingProperty: Property<Image, string>;
73export const loadMode: Property<Image, 'sync' | 'async'>;
74export const stretchProperty: Property<Image, CoreTypes.ImageStretchType>;
75export const tintColorProperty: InheritedCssProperty<Style, Color>;
76export const decodeHeightProperty: Property<Image, CoreTypes.LengthType>;
77export const decodeWidthProperty: Property<Image, CoreTypes.LengthType>;