From c3cadc7fd5c7afab37daf667227b4d55d7e07196 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 24 Aug 2021 02:55:18 -0400 Subject: [PATCH] fix(ios): backgroundColor property on Button (#9524) closes NativeScript/NativeScript#9523 --- packages/core/ui/button/index.ios.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/core/ui/button/index.ios.ts b/packages/core/ui/button/index.ios.ts index 4b0828c10..1e0cac65d 100644 --- a/packages/core/ui/button/index.ios.ts +++ b/packages/core/ui/button/index.ios.ts @@ -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,