@@ -12,7 +12,21 @@ import {
12
12
strokeColorProperty ,
13
13
strokeInactiveColorProperty ,
14
14
} from '@nativescript-community/ui-material-core/textbase/cssproperties' ;
15
- import { Background , Color , Property , Screen , Style , Utils , View , backgroundInternalProperty , editableProperty , hintProperty , isAndroid , placeholderColorProperty } from '@nativescript/core' ;
15
+ import {
16
+ Background ,
17
+ Color ,
18
+ Property ,
19
+ Screen ,
20
+ Style ,
21
+ Utils ,
22
+ View ,
23
+ backgroundInternalProperty ,
24
+ colorProperty ,
25
+ editableProperty ,
26
+ hintProperty ,
27
+ isAndroid ,
28
+ placeholderColorProperty ,
29
+ } from '@nativescript/core' ;
16
30
import { resetSymbol , textProperty } from '@nativescript/core/ui/text-base' ;
17
31
import { TextViewBase } from './textview.common' ;
18
32
@@ -269,6 +283,34 @@ export class TextView extends TextViewBase {
269
283
}
270
284
}
271
285
286
+ // Override N textview to fix textColor : use nativeViewProtected instead of nativeTextViewProtected
287
+ _isShowingHint : boolean ;
288
+ _textColor : UIColor ;
289
+ _hintColor : UIColor ;
290
+ _refreshColor ( ) {
291
+ if ( this . _isShowingHint ) {
292
+ const placeholderColor = this . style . placeholderColor ;
293
+ const color = this . style . color ;
294
+ if ( placeholderColor ) {
295
+ this . nativeViewProtected . textColor = placeholderColor . ios ;
296
+ } else if ( color ) {
297
+ // Use semi-transparent version of color for back-compatibility
298
+ this . nativeViewProtected . textColor = color . ios . colorWithAlphaComponent ( 0.22 ) ;
299
+ } else {
300
+ this . nativeViewProtected . textColor = this . _hintColor ;
301
+ }
302
+ } else {
303
+ const color = this . style . color ;
304
+ if ( color ) {
305
+ this . nativeViewProtected . textColor = color . ios ;
306
+ this . nativeViewProtected . tintColor = color . ios ;
307
+ } else {
308
+ this . nativeViewProtected . textColor = this . _textColor ;
309
+ this . nativeViewProtected . tintColor = this . _textColor ;
310
+ }
311
+ }
312
+ }
313
+
272
314
[ hintProperty . getDefault ] ( ) : string {
273
315
return '' ;
274
316
}
0 commit comments