fix(ios): backgroundColor property on Button (#9524)

closes NativeScript/NativeScript#9523
This commit is contained in:
Rob
2021-08-24 02:55:18 -04:00
committed by GitHub
parent b7b9d7c259
commit c3cadc7fd5

View File

@@ -1,10 +1,11 @@
import { ControlStateChangeListener } from '../core/control-state-change';
import { ButtonBase } from './button-common';
import { View, PseudoClassHandler } from '../core/view';
import { borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty, paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty } from '../styling/style-properties';
import { backgroundColorProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty, paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty } from '../styling/style-properties';
import { textAlignmentProperty, whiteSpaceProperty } from '../text-base';
import { layout } from '../../utils';
import { CoreTypes } from '../../core-types';
import { Color } from '../../color';
export * from './button-common';
@@ -56,6 +57,14 @@ export class Button extends ButtonBase {
}
}
[backgroundColorProperty.getDefault](): UIColor {
return this.nativeViewProtected.backgroundColor;
}
[backgroundColorProperty.setNative](value: UIColor | Color) {
this.nativeViewProtected.backgroundColor = value instanceof Color ? value.ios : value;
}
[borderTopWidthProperty.getDefault](): CoreTypes.LengthType {
return {
value: this.nativeViewProtected.contentEdgeInsets.top,