mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(core): type collisions with namespace (#8809)
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { Image as ImageDefinition, Stretch } from '.';
|
||||
import { Image as ImageDefinition } from '.';
|
||||
import { View, CSSType } from '../core/view';
|
||||
import { booleanConverter } from '../core/view-base';
|
||||
import { Enums } from '../enums';
|
||||
import { ImageAsset } from '../../image-asset';
|
||||
import { ImageSource } from '../../image-source';
|
||||
import { isDataURI, isFontIconURI, isFileOrResourcePath, RESOURCE_PREFIX } from '../../utils';
|
||||
import { Color } from '../../color';
|
||||
import { Style } from '../styling/style';
|
||||
import { Length } from '../styling/style-properties';
|
||||
import { Length, LengthType } from '../styling/style-properties';
|
||||
import { Property, InheritedCssProperty } from '../core/properties';
|
||||
import { Trace } from '../../trace';
|
||||
|
||||
@@ -15,10 +16,10 @@ export abstract class ImageBase extends View implements ImageDefinition {
|
||||
public imageSource: ImageSource;
|
||||
public src: string | ImageSource;
|
||||
public isLoading: boolean;
|
||||
public stretch: Stretch;
|
||||
public stretch: Enums.ImageStretchType;
|
||||
public loadMode: 'sync' | 'async';
|
||||
public decodeWidth: Length;
|
||||
public decodeHeight: Length;
|
||||
public decodeWidth: LengthType;
|
||||
public decodeHeight: LengthType;
|
||||
|
||||
get tintColor(): Color {
|
||||
return this.style.tintColor;
|
||||
@@ -143,7 +144,7 @@ export const isLoadingProperty = new Property<ImageBase, boolean>({
|
||||
});
|
||||
isLoadingProperty.register(ImageBase);
|
||||
|
||||
export const stretchProperty = new Property<ImageBase, Stretch>({
|
||||
export const stretchProperty = new Property<ImageBase, Enums.ImageStretchType>({
|
||||
name: 'stretch',
|
||||
defaultValue: 'aspectFit',
|
||||
affectsLayout: global.isIOS,
|
||||
@@ -158,14 +159,14 @@ export const tintColorProperty = new InheritedCssProperty<Style, Color>({
|
||||
});
|
||||
tintColorProperty.register(Style);
|
||||
|
||||
export const decodeHeightProperty = new Property<ImageBase, Length>({
|
||||
export const decodeHeightProperty = new Property<ImageBase, LengthType>({
|
||||
name: 'decodeHeight',
|
||||
defaultValue: { value: 0, unit: 'dip' },
|
||||
valueConverter: Length.parse,
|
||||
});
|
||||
decodeHeightProperty.register(ImageBase);
|
||||
|
||||
export const decodeWidthProperty = new Property<ImageBase, Length>({
|
||||
export const decodeWidthProperty = new Property<ImageBase, LengthType>({
|
||||
name: 'decodeWidth',
|
||||
defaultValue: { value: 0, unit: 'dip' },
|
||||
valueConverter: Length.parse,
|
||||
|
||||
5
packages/core/ui/image/index.d.ts
vendored
5
packages/core/ui/image/index.d.ts
vendored
@@ -4,6 +4,7 @@ import { ImageSource } from '../../image-source';
|
||||
import { Color } from '../../color';
|
||||
import { Property, InheritedCssProperty } from '../core/properties';
|
||||
import { Length } from '../styling/style-properties';
|
||||
import { Enums } from '../enums';
|
||||
|
||||
/**
|
||||
* Represents a class that provides functionality for loading and streching image(s).
|
||||
@@ -65,13 +66,11 @@ export class Image extends View {
|
||||
decodeWidth: Length;
|
||||
}
|
||||
|
||||
export type Stretch = 'none' | 'aspectFill' | 'aspectFit' | 'fill';
|
||||
|
||||
export const imageSourceProperty: Property<Image, ImageSource>;
|
||||
export const srcProperty: Property<Image, any>;
|
||||
export const isLoadingProperty: Property<Image, string>;
|
||||
export const loadMode: Property<Image, 'sync' | 'async'>;
|
||||
export const stretchProperty: Property<Image, Stretch>;
|
||||
export const stretchProperty: Property<Image, Enums.ImageStretchType>;
|
||||
export const tintColorProperty: InheritedCssProperty<Style, Color>;
|
||||
export const decodeHeightProperty: Property<Image, Length>;
|
||||
export const decodeWidthProperty: Property<Image, Length>;
|
||||
|
||||
Reference in New Issue
Block a user