mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Fix tslint errors
This commit is contained in:
@ -20,7 +20,6 @@ export class Border extends ContentView implements BorderDefinition {
|
||||
let height = layout.getMeasureSpecSize(heightMeasureSpec);
|
||||
let heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
|
||||
|
||||
let style = this.style;
|
||||
let horizontalBorderLength = this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
|
||||
let verticalBorderLength = this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
|
||||
|
||||
@ -35,7 +34,6 @@ export class Border extends ContentView implements BorderDefinition {
|
||||
}
|
||||
|
||||
public onLayout(left: number, top: number, right: number, bottom: number): void {
|
||||
let style = this.style;
|
||||
let horizontalBorderLength = this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
|
||||
let verticalBorderLength = this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
|
||||
|
||||
|
@ -69,7 +69,6 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
set [borderTopWidthProperty.native](value: Length) {
|
||||
let inset = this.nativeView.contentEdgeInsets;
|
||||
let style = this.style;
|
||||
let top = this.effectivePaddingTop + this.effectiveBorderTopWidth;
|
||||
this.nativeView.contentEdgeInsets = { top: top, left: inset.left, bottom: inset.bottom, right: inset.right };
|
||||
}
|
||||
@ -82,7 +81,6 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
set [borderRightWidthProperty.native](value: Length) {
|
||||
let inset = this.nativeView.contentEdgeInsets;
|
||||
let style = this.style;
|
||||
let right = this.effectivePaddingRight + this.effectiveBorderRightWidth;
|
||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: inset.bottom, right: right };
|
||||
}
|
||||
@ -95,7 +93,6 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
set [borderBottomWidthProperty.native](value: Length) {
|
||||
let inset = this.nativeView.contentEdgeInsets;
|
||||
let style = this.style;
|
||||
let bottom = this.effectivePaddingBottom + this.effectiveBorderBottomWidth;
|
||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: bottom, right: inset.right };
|
||||
}
|
||||
@ -108,7 +105,6 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
set [borderLeftWidthProperty.native](value: Length) {
|
||||
let inset = this.nativeView.contentEdgeInsets;
|
||||
let style = this.style;
|
||||
let left = this.effectivePaddingLeft + this.effectiveBorderLeftWidth;
|
||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: left, bottom: inset.bottom, right: inset.right };
|
||||
}
|
||||
@ -121,7 +117,6 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
set [paddingTopProperty.native](value: Length) {
|
||||
let inset = this.nativeView.contentEdgeInsets;
|
||||
let style = this.style;
|
||||
let top = this.effectivePaddingTop + this.effectiveBorderTopWidth;
|
||||
this.nativeView.contentEdgeInsets = { top: top, left: inset.left, bottom: inset.bottom, right: inset.right };
|
||||
}
|
||||
@ -134,7 +129,6 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
set [paddingRightProperty.native](value: Length) {
|
||||
let inset = this.nativeView.contentEdgeInsets;
|
||||
let style = this.style;
|
||||
let right = this.effectivePaddingRight + this.effectiveBorderRightWidth;
|
||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: inset.bottom, right: right };
|
||||
}
|
||||
@ -147,7 +141,6 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
set [paddingBottomProperty.native](value: Length) {
|
||||
let inset = this.nativeView.contentEdgeInsets;
|
||||
let style = this.style;
|
||||
let bottom = this.effectivePaddingBottom + this.effectiveBorderBottomWidth;
|
||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: bottom, right: inset.right };
|
||||
}
|
||||
@ -160,7 +153,6 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
set [paddingLeftProperty.native](value: Length) {
|
||||
let inset = this.nativeView.contentEdgeInsets;
|
||||
let style = this.style;
|
||||
let left = this.effectivePaddingLeft + this.effectiveBorderLeftWidth;
|
||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: left, bottom: inset.bottom, right: inset.right };
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ export class ContentView extends CustomLayoutView implements ContentViewDefiniti
|
||||
let height = layout.getMeasureSpecSize(heightMeasureSpec);
|
||||
let heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
|
||||
|
||||
let style = this.style;
|
||||
let measureWidth = Math.max(result.measuredWidth, this.effectiveMinWidth);
|
||||
let measureHeight = Math.max(result.measuredHeight, this.effectiveMinHeight);
|
||||
|
||||
|
@ -154,8 +154,6 @@ export class GridLayout extends GridLayoutBase {
|
||||
public onLayout(left: number, top: number, right: number, bottom: number): void {
|
||||
super.onLayout(left, top, right, bottom);
|
||||
|
||||
const style = this.style;
|
||||
|
||||
let paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft;
|
||||
let paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop;
|
||||
|
||||
|
@ -25,7 +25,32 @@ export class CssState {
|
||||
resetStyleProperties(this.view.style);
|
||||
|
||||
let matchingSelectors = this.match.selectors.filter(sel => sel.dynamic ? sel.match(this.view) : true);
|
||||
matchingSelectors.forEach(s => applyDescriptors(this.view, s.ruleset));
|
||||
matchingSelectors.forEach(s => this.applyDescriptors(this.view, s.ruleset));
|
||||
}
|
||||
|
||||
private applyDescriptors(view: ViewBase, ruleset: RuleSet): void {
|
||||
let style = view.style;
|
||||
ruleset.declarations.forEach(d => {
|
||||
let name = `css-${d.property}`;
|
||||
if (name in style) {
|
||||
style[name] = d.value;
|
||||
} else {
|
||||
view[name] = d.value;
|
||||
}
|
||||
});
|
||||
|
||||
let ruleAnimations: KeyframeAnimationInfo[] = ruleset[animationsSymbol];
|
||||
if (ruleAnimations && view.isLoaded && view.nativeView !== undefined) {
|
||||
for (let animationInfo of ruleAnimations) {
|
||||
let animation = KeyframeAnimation.keyframeAnimationFromInfo(animationInfo);
|
||||
if (animation) {
|
||||
view._registerAnimation(animation);
|
||||
animation.play(view)
|
||||
.then(() => { view._unregisterAnimation(animation); })
|
||||
.catch((e) => { view._unregisterAnimation(animation); });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,58 +274,6 @@ function isKeyframe(node: Node): node is Keyframes {
|
||||
return node.type === "keyframes";
|
||||
}
|
||||
|
||||
function applyDescriptors(view: ViewBase, ruleset: RuleSet): void {
|
||||
let style = view.style;
|
||||
ruleset.declarations.forEach(d => {
|
||||
let name = `css-${d.property}`;
|
||||
if (name in style) {
|
||||
style[name] = d.value;
|
||||
} else {
|
||||
view[name] = d.value;
|
||||
}
|
||||
});
|
||||
|
||||
// let modifier = observable.ValueSource.Css;
|
||||
// ruleset.declarations.forEach(d => withStyleProperty(d.property, d.value, (property, value) => {
|
||||
// if (types.isString(property)) {
|
||||
// const propertyName = <string>property;
|
||||
// let attrHandled = false;
|
||||
// let specialSetter = getSpecialPropertySetter(propertyName);
|
||||
|
||||
// if (!attrHandled && specialSetter) {
|
||||
// specialSetter(view, value);
|
||||
// attrHandled = true;
|
||||
// }
|
||||
|
||||
// if (!attrHandled && propertyName in view) {
|
||||
// view[propertyName] = convertString(value);
|
||||
// }
|
||||
// } else {
|
||||
// const resolvedProperty = <StyleProperty>property;
|
||||
// try {
|
||||
// view.style._setValue(resolvedProperty, value, modifier);
|
||||
// } catch (ex) {
|
||||
// if (traceEnabled) {
|
||||
// traceWrite("Error setting property: " + resolvedProperty.name + " view: " + view + " value: " + value + " " + ex, traceCategories.Style, trace.messageType.error);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }));
|
||||
|
||||
let ruleAnimations: KeyframeAnimationInfo[] = ruleset[animationsSymbol];
|
||||
if (ruleAnimations && view.isLoaded && view.nativeView !== undefined) {
|
||||
for (let animationInfo of ruleAnimations) {
|
||||
let animation = KeyframeAnimation.keyframeAnimationFromInfo(animationInfo);
|
||||
if (animation) {
|
||||
view._registerAnimation(animation);
|
||||
animation.play(view)
|
||||
.then(() => { view._unregisterAnimation(animation); })
|
||||
.catch((e) => { view._unregisterAnimation(animation); });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function applyInlineStyle(view: ViewBase, declarations: Declaration[]): void {
|
||||
let style = view.style;
|
||||
declarations.forEach(d => {
|
||||
|
@ -11,6 +11,7 @@ export class TextBase extends TextBaseCommon {
|
||||
|
||||
//Text
|
||||
get [textProperty.native](): string {
|
||||
console.log("Set textProperty.native...");
|
||||
let nativeView = this.nativeView;
|
||||
if (nativeView instanceof UIButton) {
|
||||
return nativeView.titleForState(UIControlState.Normal);
|
||||
|
Reference in New Issue
Block a user