@javascriptcommon/react-native-carplay 2.4.8 → 2.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ios/RNCarPlay.m CHANGED
@@ -527,8 +527,21 @@ RCT_EXPORT_METHOD(createTemplate:(NSString *)templateId config:(NSDictionary*)co
527
527
 
528
528
  carPlayTemplate = nowPlayingTemplate;
529
529
  } else if ([type isEqualToString:@"tabbar"]) {
530
- CPTabBarTemplate *tabBarTemplate = [[CPTabBarTemplate alloc] initWithTemplates:[self parseTemplatesFrom:config]];
530
+ NSArray<CPTemplate*> *templates = [self parseTemplatesFrom:config];
531
+
532
+ // Set tabTitle BEFORE creating TabBarTemplate
533
+ NSArray<NSDictionary*> *tpls = [RCTConvert NSDictionaryArray:config[@"templates"]];
534
+ for (NSUInteger i = 0; i < templates.count && i < tpls.count; i++) {
535
+ NSDictionary *tplConfig = tpls[i];
536
+ CPTemplate *tpl = templates[i];
537
+ if (tplConfig[@"tabTitle"]) {
538
+ tpl.tabTitle = [RCTConvert NSString:tplConfig[@"tabTitle"]];
539
+ }
540
+ }
541
+
542
+ CPTabBarTemplate *tabBarTemplate = [[CPTabBarTemplate alloc] initWithTemplates:templates];
531
543
  tabBarTemplate.delegate = self;
544
+
532
545
  carPlayTemplate = tabBarTemplate;
533
546
  } else if ([type isEqualToString:@"contact"]) {
534
547
  NSString *nm = [RCTConvert NSString:config[@"name"]];
@@ -1372,7 +1385,10 @@ RCT_EXPORT_METHOD(updateMapTemplateMapButtons:(NSString*) templateId mapButtons:
1372
1385
  NSArray<NSDictionary*> *tpls = [RCTConvert NSDictionaryArray:config[@"templates"]];
1373
1386
  for (NSDictionary *tpl in tpls) {
1374
1387
  CPTemplate *templ = [store findTemplateById:tpl[@"id"]];
1375
- // @todo UITabSystemItem
1388
+ // If template doesn't have tabTitle set, try to set it from config
1389
+ if (tpl[@"tabTitle"] && (!templ.tabTitle || [templ.tabTitle length] == 0)) {
1390
+ templ.tabTitle = [RCTConvert NSString:tpl[@"tabTitle"]];
1391
+ }
1376
1392
  [templates addObject:templ];
1377
1393
  }
1378
1394
  return templates;
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:RNCarPlay.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>RNCarPlay 2.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>1</integer>
11
+ </dict>
12
+ <key>RNCarPlay.xcscheme_^#shared#^_</key>
13
+ <dict>
14
+ <key>orderHint</key>
15
+ <integer>37</integer>
16
+ </dict>
17
+ </dict>
18
+ </dict>
19
+ </plist>
@@ -1 +1 @@
1
- {"version":3,"file":"Template.d.ts","sourceRoot":"","sources":["../../src/templates/Template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAY,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAKpD,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,EAAE,EAAE,MAAM,CAAC;CACZ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
71
71
  }
72
72
  }
73
- const result = JSON.parse(JSON.stringify(config));
73
+ // Handle templates array specially - extract id and tabTitle from Template instances
74
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
+ const configToSerialize = { ...config };
76
+ if (Array.isArray(config.templates)) {
77
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
+ configToSerialize.templates = config.templates.map((tpl) => ({
79
+ id: tpl.id,
80
+ tabTitle: tpl.config?.tabTitle,
81
+ tabImage: tpl.config?.tabImage,
82
+ tabSystemItem: tpl.config?.tabSystemItem,
83
+ tabSystemImageName: tpl.config?.tabSystemImageName,
84
+ }));
85
+ }
86
+ const result = JSON.parse(JSON.stringify(configToSerialize));
74
87
  traverse(result);
75
88
  return result;
76
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@javascriptcommon/react-native-carplay",
3
- "version": "2.4.8",
3
+ "version": "2.4.9",
4
4
  "description": "CarPlay for React Native",
5
5
  "main": "lib/index.js",
6
6
  "react-native": "src/index.ts",
@@ -161,7 +161,20 @@ export class Template<P> {
161
161
  }
162
162
  }
163
163
  }
164
- const result = JSON.parse(JSON.stringify(config));
164
+ // Handle templates array specially - extract id and tabTitle from Template instances
165
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
+ const configToSerialize = { ...config };
167
+ if (Array.isArray(config.templates)) {
168
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
169
+ configToSerialize.templates = config.templates.map((tpl: any) => ({
170
+ id: tpl.id,
171
+ tabTitle: tpl.config?.tabTitle,
172
+ tabImage: tpl.config?.tabImage,
173
+ tabSystemItem: tpl.config?.tabSystemItem,
174
+ tabSystemImageName: tpl.config?.tabSystemImageName,
175
+ }));
176
+ }
177
+ const result = JSON.parse(JSON.stringify(configToSerialize));
165
178
  traverse(result);
166
179
  return result;
167
180
  }