File tree Expand file tree Collapse file tree 4 files changed +19
-14
lines changed
Expand file tree Collapse file tree 4 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ tooltip.show({
3030 margin: [0 , 0 , 0 , 0 ],
3131 padding: [0 , 0 , 0 , 0 ],
3232 color: " yellow" ,
33- textColor: " black" ,
33+ textColor: " black" , // Optional
3434 },
3535 android: {
3636 position: " bottom" ,
@@ -89,7 +89,7 @@ export interface Options {
8989 padding: Array <any >;
9090 margin: Array <any >;
9191 color: string ;
92- textColor: string ;
92+ textColor? : string ;
9393 };
9494 android? : {
9595 position? : ToolTipPosition ;
Original file line number Diff line number Diff line change 11{
22 "name" : " nativescript-tooltip-ns" ,
3- "version" : " 1.0.5 " ,
3+ "version" : " 1.0.6 " ,
44 "description" : " NativeScript Tooltip" ,
55 "main" : " tooltip-ns" ,
66 "typings" : " index.d.ts" ,
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export interface Options {
99 padding : Array < any > ;
1010 margin : Array < any > ;
1111 color : string ;
12- textColor : string ;
12+ textColor ? : string ;
1313 } ;
1414 android ?: {
1515 position ?: ToolTipPosition ;
Original file line number Diff line number Diff line change @@ -10,17 +10,22 @@ export class TooltipNs {
1010
1111 public show ( options : Options ) {
1212 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 ;
2014
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+ }
2429
2530 this . tooltip = SexyTooltip . alloc ( ) . initWithAttributedStringSizedToViewWithPaddingAndMargin (
2631 nsAttributed ,
You can’t perform that action at this time.
0 commit comments