Skip to content

Commit 84fccb1

Browse files
committed
Add playbackProgress and accessoryImage to listItem
1 parent 985bb0d commit 84fccb1

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

packages/react-native-carplay/ios/RNCarPlay.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,12 @@ - (void)updateItemImageWithURL:(CPListItem *)item imgUrl:(NSString *)imgUrlStrin
630630
if (config[@"isPlaying"]) {
631631
[item setPlaying:[RCTConvert BOOL:config[@"isPlaying"]]];
632632
}
633+
if (@available(iOS 14.0, *) && config[@"playbackProgress"]) {
634+
[item setPlaybackProgress:[RCTConvert CGFloat:config[@"playbackProgress"]]];
635+
}
636+
if (@available(iOS 14.0, *) && config[@"accessoryImage"]) {
637+
[item setAccessoryImage:[RCTConvert UIImage:config[@"accessoryImage"]]];
638+
}
633639
} else {
634640
NSLog(@"Failed to find template %@", template);
635641
}
@@ -983,6 +989,12 @@ - (void) applyConfigForMapTemplate:(CPMapTemplate*)mapTemplate templateId:(NSStr
983989
if ([item objectForKey:@"isPlaying"]) {
984990
[_item setPlaying:[RCTConvert BOOL:[item objectForKey:@"isPlaying"]]];
985991
}
992+
if (@available(iOS 14.0, *) && [item objectForKey:@"playbackProgress"]) {
993+
[_item setPlaybackProgress:[RCTConvert CGFloat:[item objectForKey:@"playbackProgress"]]];
994+
}
995+
if (@available(iOS 14.0, *) && [item objectForKey:@"accessoryImage"]) {
996+
[_item setAccessoryImage:[RCTConvert UIImage:[item objectForKey:@"accessoryImage"]]];
997+
}
986998
if (item[@"imgUrl"]) {
987999
NSString *imgUrlString = [RCTConvert NSString:item[@"imgUrl"]];
9881000
[self updateItemImageWithURL:_item imgUrl:imgUrlString];

packages/react-native-carplay/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-carplay",
3-
"version": "2.3.3",
3+
"version": "2.3.4",
44
"description": "CarPlay for React Native",
55
"main": "lib/index.js",
66
"react-native": "src/index.ts",

packages/react-native-carplay/src/interfaces/ListItem.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@ export interface ListItem {
2828
* Is Playing flag.
2929
*/
3030
isPlaying?: boolean;
31+
/**
32+
* Value between 0.0 and 1.0 for progress bar of the list item cell.
33+
*/
34+
playbackProgress?: number;
35+
/**
36+
* The image from file system displayed on the trailing edge of the list item cell.
37+
*/
38+
accessoryImage?: ImageSourcePropType;
3139
}

0 commit comments

Comments
 (0)