@@ -172,13 +172,7 @@ export class TextField extends TextFieldBase {
172172 return this . nativeViewProtected . placeholder ;
173173 }
174174 [ hintProperty . setNative ] ( value : string ) {
175- let stringValue ;
176- if ( value === null || value === void 0 ) {
177- stringValue = "" ;
178- } else {
179- stringValue = value + "" ;
180- }
181- this . nativeViewProtected . placeholder = stringValue ;
175+ this . _updateAttributedPlaceholder ( ) ;
182176 }
183177
184178 [ secureProperty . getDefault ] ( ) : boolean {
@@ -209,18 +203,29 @@ export class TextField extends TextFieldBase {
209203 return null ;
210204 }
211205 [ placeholderColorProperty . setNative ] ( value : UIColor | Color ) {
212- let nativeView = this . nativeViewProtected ;
213- let colorAttibutes = NSMutableDictionary . new < string , any > ( ) ;
214- colorAttibutes . setValueForKey ( value instanceof Color ? value . ios : value , NSForegroundColorAttributeName ) ;
215- let stringValue ;
216- if ( nativeView . placeholder === null || nativeView . placeholder === void 0 ) {
206+ this . _updateAttributedPlaceholder ( ) ;
207+ }
208+
209+ _updateAttributedPlaceholder ( ) : void {
210+ let stringValue = this . hint ;
211+ if ( stringValue === null || stringValue === void 0 ) {
212+ stringValue = "" ;
213+ } else {
214+ stringValue = stringValue + "" ;
215+ }
216+ if ( stringValue === "" ) {
217217 // we do not use empty string since initWithStringAttributes does not return proper value and
218218 // nativeView.attributedPlaceholder will be null
219219 stringValue = " " ;
220+ }
221+ if ( placeholderColorProperty . isSet ( this . style ) ) {
222+ const attributedPlaceholder = NSAttributedString . alloc ( ) . initWithStringAttributes ( stringValue , < any > {
223+ [ NSForegroundColorAttributeName ] : this . style . placeholderColor . ios
224+ } ) ;
225+ this . nativeViewProtected . attributedPlaceholder = attributedPlaceholder ;
220226 } else {
221- stringValue = nativeView . placeholder + "" ;
227+ this . nativeViewProtected . placeholder = stringValue ;
222228 }
223- nativeView . attributedPlaceholder = NSAttributedString . alloc ( ) . initWithStringAttributes ( stringValue , colorAttibutes ) ;
224229 }
225230
226231 [ paddingTopProperty . getDefault ] ( ) : Length {
0 commit comments