From 188c1f256801b3da74594c5804c7f480685842eb Mon Sep 17 00:00:00 2001 From: Panayot Cankov Date: Fri, 20 Oct 2017 08:31:18 +0300 Subject: [PATCH] Hanlde hint color reset properly in iOS (#4968) --- tns-core-modules/ui/text-field/text-field.ios.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tns-core-modules/ui/text-field/text-field.ios.ts b/tns-core-modules/ui/text-field/text-field.ios.ts index 724911ba1..e88c7684b 100644 --- a/tns-core-modules/ui/text-field/text-field.ios.ts +++ b/tns-core-modules/ui/text-field/text-field.ios.ts @@ -218,14 +218,12 @@ export class TextField extends TextFieldBase { // nativeView.attributedPlaceholder will be null stringValue = " "; } - if (placeholderColorProperty.isSet(this.style)) { - const attributedPlaceholder = NSAttributedString.alloc().initWithStringAttributes(stringValue, { - [NSForegroundColorAttributeName]: this.style.placeholderColor.ios - }); - this.nativeViewProtected.attributedPlaceholder = attributedPlaceholder; - } else { - this.nativeViewProtected.placeholder = stringValue; + const attributes: any = {}; + if (this.style.placeholderColor) { + attributes[NSForegroundColorAttributeName] = this.style.placeholderColor.ios; } + const attributedPlaceholder = NSAttributedString.alloc().initWithStringAttributes(stringValue, attributes); + this.nativeViewProtected.attributedPlaceholder = attributedPlaceholder; } [paddingTopProperty.getDefault](): Length {