mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix the last several errors
This commit is contained in:
@@ -965,17 +965,17 @@ function updateChildLayoutParams(child: ViewCommon, parent: ViewCommon, density:
|
||||
let parentWidthMeasureSize = layout.getMeasureSpecSize(parentWidthMeasureSpec);
|
||||
let parentWidthMeasureMode = layout.getMeasureSpecMode(parentWidthMeasureSpec);
|
||||
let parentAvailableWidth = parentWidthMeasureMode === layout.UNSPECIFIED ? -1 : parentWidthMeasureSize;
|
||||
style.effectiveWidth = PercentLength.toDevicePixels(style.width, parentAvailableWidth)
|
||||
style.effectiveMarginLeft = PercentLength.toDevicePixels(style.marginLeft, parentAvailableWidth);
|
||||
style.effectiveMarginRight = PercentLength.toDevicePixels(style.marginRight, parentAvailableWidth);
|
||||
style.effectiveWidth = PercentLength.toDevicePixels(style.width, -2, parentAvailableWidth)
|
||||
style.effectiveMarginLeft = PercentLength.toDevicePixels(style.marginLeft, 0, parentAvailableWidth);
|
||||
style.effectiveMarginRight = PercentLength.toDevicePixels(style.marginRight, 0, parentAvailableWidth);
|
||||
|
||||
let parentHeightMeasureSpec = parent._currentHeightMeasureSpec;
|
||||
let parentHeightMeasureSize = layout.getMeasureSpecSize(parentHeightMeasureSpec);
|
||||
let parentHeightMeasureMode = layout.getMeasureSpecMode(parentHeightMeasureSpec);
|
||||
let parentAvailableHeight = parentHeightMeasureMode === layout.UNSPECIFIED ? -1 : parentHeightMeasureSize;
|
||||
style.effectiveHeight = PercentLength.toDevicePixels(style.height, parentAvailableHeight);
|
||||
style.effectiveMarginTop = PercentLength.toDevicePixels(style.marginTop, parentAvailableHeight);
|
||||
style.effectiveMarginBottom = PercentLength.toDevicePixels(style.marginBottom, parentAvailableHeight);
|
||||
style.effectiveHeight = PercentLength.toDevicePixels(style.height, -2, parentAvailableHeight);
|
||||
style.effectiveMarginTop = PercentLength.toDevicePixels(style.marginTop, 0, parentAvailableHeight);
|
||||
style.effectiveMarginBottom = PercentLength.toDevicePixels(style.marginBottom, 0, parentAvailableHeight);
|
||||
}
|
||||
|
||||
function equalsCommon(a: Length, b: Length): boolean;
|
||||
@@ -1066,7 +1066,7 @@ export namespace PercentLength {
|
||||
}
|
||||
}
|
||||
export const equals: { (a: PercentLength, b: PercentLength): boolean } = equalsCommon;
|
||||
export const toDevicePixels: { (length: PercentLength, parentAvailableWidth: number): number } = toDevicePixelsCommon;
|
||||
export const toDevicePixels: { (length: PercentLength, auto: number, parentAvailableWidth: number): number } = toDevicePixelsCommon;
|
||||
}
|
||||
|
||||
export type Length = "auto" | number | {
|
||||
|
||||
29
tns-core-modules/ui/core/view.d.ts
vendored
29
tns-core-modules/ui/core/view.d.ts
vendored
@@ -102,6 +102,12 @@ declare module "ui/core/view" {
|
||||
export namespace Length {
|
||||
export function parse(text: string): Length;
|
||||
export function equals(a: Length, b: Length): boolean;
|
||||
/**
|
||||
* Converts Length unit to device pixels.
|
||||
* @param length The PercentLength to convert.
|
||||
* @param auto Value to use for conversion of "auto".
|
||||
*/
|
||||
export function toDevicePixels(length: PercentLength, auto: number): number;
|
||||
}
|
||||
|
||||
export type PercentLength = "auto" | number | {
|
||||
@@ -111,6 +117,13 @@ declare module "ui/core/view" {
|
||||
export namespace PercentLength {
|
||||
export function parse(text: string): PercentLength;
|
||||
export function equals(a: PercentLength, b: PercentLength): boolean;
|
||||
/**
|
||||
* Converts PercentLength unit to device pixels.
|
||||
* @param length The PercentLength to convert.
|
||||
* @param auto Value to use for conversion of "auto".
|
||||
* @param parentAvailableWidth Value to use as base when converting percent unit.
|
||||
*/
|
||||
export function toDevicePixels(length: PercentLength, auto: number, parentAvailableWidth: number): number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -604,15 +617,15 @@ declare module "ui/core/view" {
|
||||
// _onStylePropertyChanged(property: dependencyObservable.Property): void;
|
||||
//@endprivate
|
||||
|
||||
// /**
|
||||
// * __Obsolete:__ There is a new property system that does not rely on _getValue.
|
||||
// */
|
||||
// public _getValue(property: any): never;
|
||||
/**
|
||||
* __Obsolete:__ There is a new property system that does not rely on _getValue.
|
||||
*/
|
||||
public _getValue(property: any): never;
|
||||
|
||||
// /**
|
||||
// * __Obsolete:__ There is a new property system that does not rely on _setValue.
|
||||
// */
|
||||
// public _setValue(property: any, value: any): never;
|
||||
/**
|
||||
* __Obsolete:__ There is a new property system that does not rely on _setValue.
|
||||
*/
|
||||
public _setValue(property: any, value: any): never;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
2
tns-core-modules/ui/definitions.d.ts
vendored
2
tns-core-modules/ui/definitions.d.ts
vendored
@@ -93,7 +93,7 @@ declare module "ui/core/view-base" {
|
||||
public onLoaded(): void;
|
||||
public onUnloaded(): void;
|
||||
|
||||
public bind(options: BindingOptions, source: Object): void;
|
||||
public bind(options: BindingOptions, source?: Object): void;
|
||||
public unbind(property: string): void;
|
||||
|
||||
public requestLayout(): void;
|
||||
|
||||
Reference in New Issue
Block a user