File tree 4 files changed +19
-14
lines changed
4 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ tooltip.show({
30
30
margin: [0 , 0 , 0 , 0 ],
31
31
padding: [0 , 0 , 0 , 0 ],
32
32
color: " yellow" ,
33
- textColor: " black" ,
33
+ textColor: " black" , // Optional
34
34
},
35
35
android: {
36
36
position: " bottom" ,
@@ -89,7 +89,7 @@ export interface Options {
89
89
padding: Array <any >;
90
90
margin: Array <any >;
91
91
color: string ;
92
- textColor: string ;
92
+ textColor? : string ;
93
93
};
94
94
android? : {
95
95
position? : ToolTipPosition ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " nativescript-tooltip-ns" ,
3
- "version" : " 1.0.5 " ,
3
+ "version" : " 1.0.6 " ,
4
4
"description" : " NativeScript Tooltip" ,
5
5
"main" : " tooltip-ns" ,
6
6
"typings" : " index.d.ts" ,
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export interface Options {
9
9
padding : Array < any > ;
10
10
margin : Array < any > ;
11
11
color : string ;
12
- textColor : string ;
12
+ textColor ? : string ;
13
13
} ;
14
14
android ?: {
15
15
position ?: ToolTipPosition ;
Original file line number Diff line number Diff line change @@ -10,17 +10,22 @@ export class TooltipNs {
10
10
11
11
public show ( options : Options ) {
12
12
let self = Frame . topmost ( ) . ios . controller ;
13
- var nsAttributed = NSAttributedString . alloc ( ) . initWithStringAttributes (
14
- options . message ,
15
- new NSDictionary (
16
- [ new Color ( options . ios . textColor ) . ios ] ,
17
- [ NSForegroundColorAttributeName ]
18
- )
19
- ) ;
13
+ let nsAttributed ;
20
14
21
- let nsAttributed = NSAttributedString . alloc ( ) . initWithString (
22
- options . message
23
- ) ;
15
+ if (
16
+ options . ios . textColor . length > 0 &&
17
+ typeof options . ios . textColor !== "undefined"
18
+ ) {
19
+ nsAttributed = NSAttributedString . alloc ( ) . initWithStringAttributes (
20
+ options . message ,
21
+ new NSDictionary (
22
+ [ new Color ( options . ios . textColor ) . ios ] ,
23
+ [ NSForegroundColorAttributeName ]
24
+ )
25
+ ) ;
26
+ } else {
27
+ nsAttributed = NSAttributedString . alloc ( ) . initWithString ( options . message ) ;
28
+ }
24
29
25
30
this . tooltip = SexyTooltip . alloc ( ) . initWithAttributedStringSizedToViewWithPaddingAndMargin (
26
31
nsAttributed ,
You can’t perform that action at this time.
0 commit comments