diff --git a/packages/react-native-carplay/ios/RNCarPlay.m b/packages/react-native-carplay/ios/RNCarPlay.m index cb74860..153dbad 100644 --- a/packages/react-native-carplay/ios/RNCarPlay.m +++ b/packages/react-native-carplay/ios/RNCarPlay.m @@ -319,11 +319,23 @@ - (void)updateListRowItemImageWithURL:(CPListImageRowItem *)item imgUrl:(NSStrin NSDictionary *body = @{@"templateId":templateId, @"id": _button[@"id"] }; Class buttonClass = buttonTypeMapping[buttonType]; if (buttonClass) { - CPNowPlayingButton *button = [[buttonClass alloc] initWithHandler:^(__kindof CPNowPlayingButton * _Nonnull) { - if (self->hasListeners) { - [self sendEventWithName:@"buttonPressed" body:body]; - } - }]; + CPNowPlayingButton *button; + + if ([buttonType isEqualToString:@"image"]) { + UIImage *_image = [RCTConvert UIImage:[_button objectForKey:@"image"]]; + button = [[CPNowPlayingImageButton alloc] initWithImage:_image handler:^(__kindof CPNowPlayingImageButton * _Nonnull) { + if (self->hasListeners) { + [self sendEventWithName:@"buttonPressed" body:body]; + } + }]; + } else { + button = [[buttonClass alloc] initWithHandler:^(__kindof CPNowPlayingButton * _Nonnull) { + if (self->hasListeners) { + [self sendEventWithName:@"buttonPressed" body:body]; + } + }]; + } + [buttons addObject:button]; } }