Allow nil tabbar item icon

Reviewed By: @nicklockwood

Differential Revision: D2508310

fb-gh-sync-id: e4eaf1237cca380b74d154c3cda50379fbafcf00
This commit is contained in:
Pieter De Baets 2015-10-06 07:42:59 -07:00 committed by facebook-github-bot-4
parent 81278d1a39
commit 06ef95799a
1 changed files with 5 additions and 5 deletions

View File

@ -54,8 +54,8 @@
UIImage *image = [RCTConvert UIImage:_icon];
UITabBarItem *oldItem = _barItem;
if (image) {
// Recreate barItem if previous item was a system icon
// Recreate barItem if previous item was a system icon. Calling self.barItem
// creates a new instance if it wasn't set yet.
if (wasSystemIcon) {
_barItem = nil;
self.barItem.image = image;
@ -63,9 +63,7 @@
self.barItem.image = image;
return;
}
} else {
} else if ([icon isKindOfClass:[NSString class]] && [icon length] > 0) {
// Not a custom image, may be a system item?
NSNumber *systemIcon = systemIcons[icon];
if (!systemIcon) {
@ -73,6 +71,8 @@
return;
}
_barItem = [[UITabBarItem alloc] initWithTabBarSystemItem:systemIcon.integerValue tag:oldItem.tag];
} else {
self.barItem.image = nil;
}
// Reapply previous properties