Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion ios/RNSBarButtonItem.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,28 @@ - (instancetype)initWithConfig:(NSDictionary<NSString *, id> *)dict
menuAction:(RNSBarButtonMenuItemAction)menuAction
imageLoader:(RCTImageLoader *)imageLoader
{
// When title is equal to "search", then use the system search item
// TODO: in actual implementation add a field to config to specify system item type
// https://developer.apple.com/documentation/uikit/uibarbuttonitem/systemitem?language=objc
NSString *title = dict[@"title"];
if (title != nil && [title isEqualToString:@"search"]) {
self = [super initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:nil action:nil];
if (self) {
NSString *buttonId = dict[@"buttonId"];
if (buttonId && action) {
self.target = self;
self.action = @selector(handleBarButtonItemPress:);
_itemAction = action;
_buttonId = buttonId;
}
}
return self;
}
self = [super init];
if (!self) {
return self;
}

NSString *title = dict[@"title"];
NSDictionary *imageSourceObj = dict[@"imageSource"];
NSDictionary *templateSourceObj = dict[@"templateSource"];
NSString *sfSymbolName = dict[@"sfSymbolName"];
Expand Down