mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
up to segmented-bar.ios
This commit is contained in:
@@ -1,17 +1,9 @@
|
||||
import { Progress as ProgressDefinition } from "ui/progress";
|
||||
import { View, Property } from "ui/core/view";
|
||||
import { View, Property, CoercibleProperty } from "ui/core/view";
|
||||
|
||||
export * from "ui/core/view";
|
||||
|
||||
export class ProgressBase extends View implements ProgressDefinition {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
// This calls make both platforms have default values from 0 to 100.
|
||||
this.maxValue = 100;
|
||||
this.value = 0;
|
||||
}
|
||||
|
||||
public value: number;
|
||||
public maxValue: number;
|
||||
// get maxValue(): number {
|
||||
@@ -38,11 +30,11 @@ export class ProgressBase extends View implements ProgressDefinition {
|
||||
/**
|
||||
* Represents the observable property backing the value property of each Progress instance.
|
||||
*/
|
||||
export const valueProperty = new Property<ProgressBase, number>({ name: "value", defaultValue: 0 });
|
||||
export const valueProperty = new CoercibleProperty<ProgressBase, number>({ name: "value", defaultValue: 0, coerceValue: (t, v) => v < 0 ? 0 : Math.min(v, t.maxValue) });
|
||||
valueProperty.register(ProgressBase);
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the maxValue property of each Progress instance.
|
||||
*/
|
||||
export const maxValueProperty = new Property<ProgressBase, number>({ name: "maxValue", defaultValue: 100 });
|
||||
export const maxValueProperty = new Property<ProgressBase, number>({ name: "maxValue", defaultValue: 100, valueChanged: (target, oldValue, newValue) => valueProperty.coerce(target) });
|
||||
maxValueProperty.register(ProgressBase);
|
||||
@@ -1,5 +1,7 @@
|
||||
import { ProgressBase, valueProperty, maxValueProperty } from "./progress-common";
|
||||
import { View, Color, colorProperty, backgroundColorProperty, backgroundInternalProperty } from "ui/core/view";
|
||||
import {
|
||||
View, Color, ProgressBase, valueProperty, maxValueProperty,
|
||||
colorProperty, backgroundColorProperty, backgroundInternalProperty
|
||||
} from "./progress-common";
|
||||
|
||||
export * from "./progress-common";
|
||||
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import { ProgressBase, valueProperty, maxValueProperty } from "./progress-common";
|
||||
import { View, Color, colorProperty, backgroundColorProperty, backgroundInternalProperty } from "ui/core/view";
|
||||
import {
|
||||
ProgressBase, View, Color, valueProperty, maxValueProperty,
|
||||
colorProperty, backgroundColorProperty, backgroundInternalProperty
|
||||
} from "./progress-common";
|
||||
|
||||
export * from "./progress-common";
|
||||
|
||||
export class Progress extends ProgressBase {
|
||||
private _ios: UIProgressView;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this._ios = UIProgressView.new();
|
||||
}
|
||||
private _ios = UIProgressView.new();
|
||||
|
||||
get ios(): UIProgressView {
|
||||
return this._ios;
|
||||
@@ -51,11 +47,11 @@ export class Progress extends ProgressBase {
|
||||
this._ios.trackTintColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
get [backgroundInternalProperty.native](): UIColor {
|
||||
return null;
|
||||
}
|
||||
set [backgroundInternalProperty.native](value: Color) {
|
||||
//
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user