MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / _getIcon

Method _getIcon

packages/core/ui/tab-view/index.ios.ts:623–657  ·  view source on GitHub ↗
(item: TabViewItem)

Source from the content-addressed store, hash-verified

621 }
622
623 public _getIcon(item: TabViewItem): UIImage {
624 if (!item || !item.iconSource) {
625 return null;
626 }
627
628 let image: UIImage = this._iconsCache[item.iconSource];
629 if (!image) {
630 let is: ImageSource;
631 if (isSystemURI(item.iconSource)) {
632 is = ImageSource.fromSystemImageSync(item.iconSource.slice(SYSTEM_PREFIX.length));
633 } else if (isFontIconURI(item.iconSource)) {
634 // Allow specifying a separate font family for the icon via style.iconFontFamily.
635 // If provided, construct a Font from the family and (optionally) size from fontInternal.
636 let iconFont = item.style.fontInternal;
637 const iconFontFamily = item.iconFontFamily || item.style.iconFontFamily;
638 if (iconFontFamily) {
639 // Preserve size/style from existing fontInternal if present.
640 const baseFont = item.style.fontInternal || Font.default;
641 iconFont = baseFont.withFontFamily(iconFontFamily);
642 }
643 is = ImageSource.fromFontIconCodeSync(item.iconSource.slice(FONT_PREFIX.length), iconFont, item.style.color);
644 } else {
645 is = ImageSource.fromFileOrResourceSync(item.iconSource);
646 }
647 if (is && is.ios) {
648 const originalRenderedImage = is.ios.imageWithRenderingMode(this._getIconRenderingMode());
649 this._iconsCache[item.iconSource] = originalRenderedImage;
650 image = originalRenderedImage;
651 } else {
652 traceMissingIcon(item.iconSource);
653 }
654 }
655
656 return image;
657 }
658
659 private _updateIOSTabBarColorsAndFonts(): void {
660 if (!this.items) {

Callers 2

setViewControllersMethod · 0.95
_updateMethod · 0.80

Calls 9

_getIconRenderingModeMethod · 0.95
isSystemURIFunction · 0.90
isFontIconURIFunction · 0.90
traceMissingIconFunction · 0.90
fromSystemImageSyncMethod · 0.45
sliceMethod · 0.45
withFontFamilyMethod · 0.45
fromFontIconCodeSyncMethod · 0.45

Tested by

no test coverage detected