UNPKG

@nativescript-community/ui-image

Version:

Advanced and efficient image display plugin which uses Fresco (Android) and SDWebImage (iOS) to implement caching, placeholders, image effects, and much more.

123 lines (122 loc) 4.86 kB
import { Color, CoreTypes, Property, View } from '@nativescript/core'; import { EventData as IEventData } from '@nativescript/core/data/observable'; import { ImageAsset } from '@nativescript/core/image-asset'; import { ImageSource } from '@nativescript/core/image-source'; export declare enum CLogTypes { log, info, warning, error } export declare const ImageViewTraceCategory = "NativescriptImage"; export declare const CLog: (type: CLogTypes, ...args: any[]) => void; export declare type Transition = 'fade' | 'curlUp'; export declare enum ScaleType { None = "none", Fill = "fill", AspectFill = "aspectFill", AspectFit = "aspectFit", Center = "center", CenterCrop = "centerCrop", CenterInside = "centerInside", FitCenter = "fitCenter", FitEnd = "fitEnd", FitStart = "fitStart", FitXY = "fitXY", FocusCrop = "focusCrop" } export interface AnimatedImage { start(): void; stop(): void; isRunning(): boolean; } export interface ImageInfo { getHeight(): number; getWidth(): number; } export interface ImageError { getMessage(): string; getErrorType(): string; toString(): string; } export interface ImagePipelineConfigSetting { isDownsampleEnabled?: boolean; leakTracker?: any; } export declare class EventData implements IEventData { private _eventName; private _object; get eventName(): string; set eventName(value: string); get object(): any; set object(value: any); } export declare type Stretch = 'none' | 'fill' | 'aspectFill' | 'aspectFit'; export declare class ImageBase extends View { static finalImageSetEvent: string; static failureEvent: string; static intermediateImageFailedEvent: string; static intermediateImageSetEvent: string; static releaseEvent: string; static submitEvent: string; src: string | ImageSource | ImageAsset; lowerResSrc: string; placeholderImageUri: string; failureImageUri: string; stretch: ScaleType; fadeDuration: number; backgroundUri: string; progressiveRenderingEnabled: boolean; localThumbnailPreviewsEnabled: boolean; showProgressBar: boolean; progressBarColor: string; roundAsCircle: boolean; roundBottomRightRadius: number; roundTopLeftRadius: number; roundTopRightRadius: number; roundBottomLeftRadius: number; blurRadius: number; blurDownSampling: number; autoPlayAnimations: boolean; tapToRetryEnabled: boolean; aspectRatio: number; decodeWidth: number; decodeHeight: number; alwaysFade: boolean; noCache: boolean; tintColor: Color; readonly isLoading: boolean; static srcProperty: Property<ImageBase, string | ImageSource | ImageAsset>; static lowerResSrcProperty: Property<ImageBase, string>; static placeholderImageUriProperty: Property<ImageBase, string>; static failureImageUriProperty: Property<ImageBase, string>; static stretchProperty: Property<ImageBase, string>; static backgroundUriProperty: Property<ImageBase, string>; static progressiveRenderingEnabledProperty: Property<ImageBase, boolean>; static localThumbnailPreviewsEnabledProperty: Property<ImageBase, boolean>; static showProgressBarProperty: Property<ImageBase, boolean>; static progressBarColorProperty: Property<ImageBase, string>; static roundAsCircleProperty: Property<ImageBase, boolean>; static blurRadiusProperty: Property<ImageBase, number>; static blurDownSamplingProperty: Property<ImageBase, number>; static autoPlayAnimationsProperty: Property<ImageBase, boolean>; static tapToRetryEnabledProperty: Property<ImageBase, boolean>; static aspectRatioProperty: Property<ImageBase, number>; static decodeWidthProperty: Property<ImageBase, number>; static decodeHeightProperty: Property<ImageBase, number>; static tintColorProperty: Property<ImageBase, Color>; static alwaysFadeProperty: Property<ImageBase, boolean>; static fadeDurationProperty: Property<ImageBase, number>; static noCacheProperty: Property<ImageBase, boolean>; static roundTopLeftRadiusProperty: Property<ImageBase, CoreTypes.LengthType>; static roundTopRightRadiusProperty: Property<ImageBase, CoreTypes.LengthType>; static roundBottomLeftRadiusProperty: Property<ImageBase, CoreTypes.LengthType>; static roundBottomRightRadiusProperty: Property<ImageBase, CoreTypes.LengthType>; static clipToBoundsProperty: Property<ImageBase, boolean>; protected handleImageProgress(value: number, totalSize?: number): void; private static needsSizeAdjustment; computeScaleFactor(measureWidth: number, measureHeight: number, widthIsFinite: boolean, heightIsFinite: boolean, nativeWidth: number, nativeHeight: number, aspectRatio: number): { width: number; height: number; }; }