|
1 | | -import { Application, Color, CoreTypes, Font, ImageSource, Utils, getTransformedText } from '@nativescript/core'; |
| 1 | +import { Application, Color, CoreTypes, Font, ImageAsset, ImageSource, Utils, getTransformedText } from '@nativescript/core'; |
2 | 2 | import { TabContentItem } from '../tab-content-item'; |
3 | 3 | import { getIconSpecSize, itemsProperty, selectedIndexProperty, tabStripProperty } from '../tab-navigation-base'; |
4 | 4 | import { TabStrip } from '../tab-strip'; |
@@ -459,25 +459,29 @@ export abstract class TabNavigation<T extends android.view.ViewGroup = any> exte |
459 | 459 | } |
460 | 460 |
|
461 | 461 | private getOriginalIcon(tabStripItem: TabStripItem, color?: Color): android.graphics.Bitmap { |
462 | | - const iconSource = tabStripItem.image && tabStripItem.image.src; |
| 462 | + const iconSource = tabStripItem.image?.src; |
463 | 463 | if (!iconSource) { |
464 | 464 | return null; |
465 | 465 | } |
466 | 466 |
|
467 | | - let is: ImageSource; |
468 | | - if (Utils.isFontIconURI(iconSource)) { |
469 | | - const fontIconCode = iconSource.split('//')[1]; |
470 | | - const target = tabStripItem.image ? tabStripItem.image : tabStripItem; |
471 | | - const font = target.style.fontInternal; |
472 | | - if (!color) { |
473 | | - color = target.style.color; |
| 467 | + let is: ImageSource | ImageAsset; |
| 468 | + if (typeof iconSource === 'string') { |
| 469 | + if (Utils.isFontIconURI(iconSource)) { |
| 470 | + const fontIconCode = iconSource.split('//')[1]; |
| 471 | + const target = tabStripItem.image ? tabStripItem.image : tabStripItem; |
| 472 | + const font = target.style.fontInternal; |
| 473 | + if (!color) { |
| 474 | + color = target.style.color; |
| 475 | + } |
| 476 | + is = ImageSource.fromFontIconCodeSync(fontIconCode, font, color); |
| 477 | + } else { |
| 478 | + is = ImageSource.fromFileOrResourceSync(iconSource); |
474 | 479 | } |
475 | | - is = ImageSource.fromFontIconCodeSync(fontIconCode, font, color); |
476 | 480 | } else { |
477 | | - is = ImageSource.fromFileOrResourceSync(iconSource); |
| 481 | + is = iconSource; |
478 | 482 | } |
479 | 483 |
|
480 | | - return is && is.android; |
| 484 | + return is?.android; |
481 | 485 | } |
482 | 486 |
|
483 | 487 | private getDrawableInfo(image: android.graphics.Bitmap): IconInfo { |
|
0 commit comments