@iternio/react-native-auto-play 0.1.16 → 0.1.18
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/README.md +278 -7
- package/ios/scenes/AutoPlayInterfaceController.swift +3 -0
- package/ios/scenes/HeadUnitSceneDelegate.swift +5 -2
- package/ios/templates/MapTemplate.swift +10 -4
- package/lib/hooks/useIsAutoPlayFocused.d.ts +7 -0
- package/lib/hooks/useIsAutoPlayFocused.js +20 -0
- package/lib/hybrid.d.ts +2 -0
- package/lib/hybrid.js +2 -0
- package/lib/specs/AutomotivePermissionRequestTemplate.d.ts +11 -0
- package/lib/specs/AutomotivePermissionRequestTemplate.nitro.d.ts +11 -0
- package/lib/specs/AutomotivePermissionRequestTemplate.nitro.js +1 -0
- package/lib/specs/SignInTemplate.nitro.d.ts +12 -0
- package/lib/specs/SignInTemplate.nitro.js +1 -0
- package/lib/templates/AutomotivePermissionRequestTemplate.d.ts +23 -0
- package/lib/templates/AutomotivePermissionRequestTemplate.js +18 -0
- package/lib/templates/SignInTemplate.d.ts +49 -0
- package/lib/templates/SignInTemplate.js +51 -0
- package/lib/types/SignInMethod.d.ts +38 -0
- package/lib/types/SignInMethod.js +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/AssetImage.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/AutoText.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Distance.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/DurationWithTimeZone.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GlyphImage.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GridTemplateConfig.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ImageLane.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/InformationTemplateConfig.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/LaneGuidance.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ListTemplateConfig.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Location.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/MapTemplateConfig.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/MessageTemplateConfig.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NavigationAlertAction.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAction.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAttributedString.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAttributedStringImage.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroBaseMapTemplateConfig.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroColor.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroGridButton.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroLoadingManeuver.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroMapButton.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroMessageManeuver.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroNavigationAlert.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRoutingManeuver.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRow.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroSection.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NumericTelemetryItem.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Point.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/PreferredImageLane.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/RouteChoice.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/SafeAreaInsets.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/SearchTemplateConfig.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/StringTelemetryItem.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Telemetry.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TravelEstimates.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripConfig.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripPoint.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripPreviewTextConfiguration.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripSelectorCallback.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripsConfig.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VehicleTelemetryItem.kt +1 -1
- package/package.json +1 -1
- package/lib/specs/VoiceInput.nitro.d.ts +0 -8
- /package/lib/specs/{VoiceInput.nitro.js → AutomotivePermissionRequestTemplate.js} +0 -0
package/README.md
CHANGED
|
@@ -347,6 +347,232 @@ export default registerAutoPlay;
|
|
|
347
347
|
|
|
348
348
|
- `HybridAutoPlay`: The primary interface for interacting with the native module, handling connection status and events.
|
|
349
349
|
|
|
350
|
+
### Core Types
|
|
351
|
+
|
|
352
|
+
#### AutoText
|
|
353
|
+
Most text props accept `AutoText` so you can localize and provide variants. You can pass either a string or an object with `text`/`variants` as used throughout the example app.
|
|
354
|
+
|
|
355
|
+
#### AutoImage
|
|
356
|
+
Images are provided as `AutoImage` objects with a `type` and `name`. The built-in icon set is Material Symbols (see **Icons**). You can also use bundled images from your native project.
|
|
357
|
+
|
|
358
|
+
#### RootComponentInitialProps
|
|
359
|
+
All root components rendered by templates/scenes receive `RootComponentInitialProps`:
|
|
360
|
+
|
|
361
|
+
- `id`: Module identifier (e.g. `AutoPlayRoot`, `CarPlayDashboard`, or a cluster UUID).
|
|
362
|
+
- `rootTag`: React Native root tag.
|
|
363
|
+
- `colorScheme`: `'light' | 'dark'` initial color scheme (listen to `onAppearanceDidChange` on `MapTemplate` for updates).
|
|
364
|
+
- `window`: `{ width, height, scale }`.
|
|
365
|
+
|
|
366
|
+
### Template Configs (Props)
|
|
367
|
+
|
|
368
|
+
Below is a concise overview of the most important props per template. Optional props are marked as **optional**. Required props are marked as **required**.
|
|
369
|
+
|
|
370
|
+
#### MapTemplateConfig
|
|
371
|
+
|
|
372
|
+
| Prop | Type | Required | Notes |
|
|
373
|
+
| --- | --- | --- | --- |
|
|
374
|
+
| `component` | `React.ComponentType<RootComponentInitialProps>` | ✅ | React component to render on the map surface. |
|
|
375
|
+
| `onStopNavigation` | `(template: MapTemplate) => void` | ✅ | Called when navigation is stopped by the system. |
|
|
376
|
+
| `headerActions` | `MapHeaderActions<MapTemplate>` | ❌ | Top action strip. See **Header Actions** below. |
|
|
377
|
+
| `mapButtons` | `MapButtons<MapTemplate>` | ❌ | 1–4 map buttons shown on the map. |
|
|
378
|
+
| `visibleTravelEstimate` | `'first'` `'last'` | ❌ | Which travel estimate to display. |
|
|
379
|
+
| `onDidPan` / `onDidUpdateZoomGestureWithCenter` | callbacks | ❌ | Map gesture events. |
|
|
380
|
+
| `onAppearanceDidChange` | `(colorScheme) => void` | ❌ | Listen for light/dark mode changes. |
|
|
381
|
+
| `onAutoDriveEnabled` | `(template) => void` | ⚠️ | Android-only auto drive callback. Make sure to take action when receiving this and simulate a drive to the set destination. [Check Android docs for details](https://developer.android.com/reference/androidx/car/app/navigation/NavigationManagerCallback#onAutoDriveEnabled()) |
|
|
382
|
+
|
|
383
|
+
#### ListTemplateConfig
|
|
384
|
+
|
|
385
|
+
| Prop | Type | Required | Notes |
|
|
386
|
+
| --- | --- | --- | --- |
|
|
387
|
+
| `title` | `AutoText` | ✅ | Header title. |
|
|
388
|
+
| `sections` | `Section<ListTemplate>` | ❌ | List sections/rows. Not providing anything here will result in a loading indicator on Android and an empty list on iOS. |
|
|
389
|
+
| `headerActions` | `HeaderActions<ListTemplate>` | ❌ | Header actions. See **Header Actions** below. |
|
|
390
|
+
| `mapConfig` | `BaseMapTemplateConfig<ListTemplate>` | ❌ | Android map-with-content layout. |
|
|
391
|
+
|
|
392
|
+
#### GridTemplateConfig
|
|
393
|
+
|
|
394
|
+
| Prop | Type | Required | Notes |
|
|
395
|
+
| --- | --- | --- | --- |
|
|
396
|
+
| `title` | `AutoText` | ✅ | Header title. |
|
|
397
|
+
| `buttons` | `GridButton<GridTemplate>[]` | ✅ | Grid items. Providing an empty array will result in a loading indicator on Android and an empty template on iOS. |
|
|
398
|
+
| `headerActions` | `HeaderActions<GridTemplate>` | ❌ | Header actions. See **Header Actions** below. |
|
|
399
|
+
| `mapConfig` | `BaseMapTemplateConfig<GridTemplate>` | ❌ | Android map-with-content layout. |
|
|
400
|
+
|
|
401
|
+
#### SearchTemplateConfig
|
|
402
|
+
|
|
403
|
+
| Prop | Type | Required | Notes |
|
|
404
|
+
| --- | --- | --- | --- |
|
|
405
|
+
| `title` | `AutoText` | ✅ | Header title. |
|
|
406
|
+
| `results` | `SearchSection<SearchTemplate>` | ❌ | Initial results. |
|
|
407
|
+
| `headerActions` | `HeaderActions<SearchTemplate>` | ❌ | Header actions. See **Header Actions** below. |
|
|
408
|
+
| `searchHint` | `string` | ❌ | Android-only placeholder. |
|
|
409
|
+
| `initialSearchText` | `string` | ❌ | Android-only initial value. |
|
|
410
|
+
| `onSearchTextChanged` | `(text) => void` | ✅ | Fired on text input changes. |
|
|
411
|
+
| `onSearchTextSubmitted` | `(text) => void` | ✅ | Fired on submit. |
|
|
412
|
+
|
|
413
|
+
#### InformationTemplateConfig
|
|
414
|
+
|
|
415
|
+
| Prop | Type | Required | Notes |
|
|
416
|
+
| --- | --- | --- | --- |
|
|
417
|
+
| `title` | `AutoText` | ✅ | Header title. |
|
|
418
|
+
| `items` | `InformationItems` | ❌ | 1–4 rows. |
|
|
419
|
+
| `actions` | platform-specific | ❌ | Up to 2 buttons on Android, up to 3 on iOS. |
|
|
420
|
+
| `headerActions` | `HeaderActions<InformationTemplate>` | ❌ | Header actions. See **Header Actions** below. |
|
|
421
|
+
| `mapConfig` | `BaseMapTemplateConfig<InformationTemplate>` | ❌ | Android map-with-content layout. |
|
|
422
|
+
|
|
423
|
+
#### MessageTemplateConfig
|
|
424
|
+
|
|
425
|
+
| Prop | Type | Required | Notes |
|
|
426
|
+
| --- | --- | --- | --- |
|
|
427
|
+
| `message` | `AutoText` | ✅ | Main message text. |
|
|
428
|
+
| `title` | `AutoText` | ❌ | Android header title. |
|
|
429
|
+
| `image` | `AutoImage` | ❌ | Android-only image above the message. |
|
|
430
|
+
| `actions` | platform-specific | ❌ | Up to 2 buttons on Android, up to 3 on iOS. |
|
|
431
|
+
| `headerActions` | `HeaderActionsAndroid<MessageTemplate>` | ❌ | Android-only header actions. |
|
|
432
|
+
| `mapConfig` | `BaseMapTemplateConfig<MessageTemplate>` | ❌ | Android map-with-content layout. |
|
|
433
|
+
|
|
434
|
+
### Header Actions (Important)
|
|
435
|
+
|
|
436
|
+
On Android, header actions may be omitted, although this is not recommended. If `headerActions` is `undefined`, the system automatically renders the app icon in the header. Because Android Auto enforces monochrome icons, this can result in a poor-looking button.
|
|
437
|
+
|
|
438
|
+
**Use these rules to avoid crashes:**
|
|
439
|
+
|
|
440
|
+
1. **For List/Grid/Information/Search/Message templates on Android**, always pass the structured object format (alignment is implicit via `startHeaderAction`/`endHeaderActions`):
|
|
441
|
+
|
|
442
|
+
```ts
|
|
443
|
+
const headerActions: HeaderActions<MyTemplate> = {
|
|
444
|
+
android: {
|
|
445
|
+
startHeaderAction: { type: 'back', onPress: (t) => HybridAutoPlay.popTemplate() },
|
|
446
|
+
endHeaderActions: [
|
|
447
|
+
{ type: 'image', image: { name: 'help', type: 'glyph' }, onPress: () => {} },
|
|
448
|
+
],
|
|
449
|
+
},
|
|
450
|
+
ios: {
|
|
451
|
+
backButton: { type: 'back', onPress: (t) => HybridAutoPlay.popTemplate() },
|
|
452
|
+
trailingNavigationBarButtons: [
|
|
453
|
+
{ type: 'image', image: { name: 'close', type: 'glyph' }, onPress: () => {} },
|
|
454
|
+
],
|
|
455
|
+
},
|
|
456
|
+
};
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
⚠️ **Do not pass a raw array of actions** to `headerActions` on Android for these templates. Arrays are only valid for **MapTemplate** header actions (see below). Passing an array for header-based templates results in actions without alignment and can crash on Android.
|
|
460
|
+
|
|
461
|
+
2. **For MapTemplate on Android**, you can use the array format (1–4 actions) for the action strip:
|
|
462
|
+
|
|
463
|
+
```ts
|
|
464
|
+
const mapHeaderActions: MapTemplateConfig['headerActions'] = {
|
|
465
|
+
android: [
|
|
466
|
+
{ type: 'image', image: { name: 'list', type: 'glyph' }, onPress: () => {} },
|
|
467
|
+
{ type: 'image', image: { name: 'search', type: 'glyph' }, onPress: () => {} },
|
|
468
|
+
],
|
|
469
|
+
ios: {
|
|
470
|
+
leadingNavigationBarButtons: [
|
|
471
|
+
{ type: 'image', image: { name: 'list', type: 'glyph' }, onPress: () => {} },
|
|
472
|
+
],
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
**Header action shapes (structured overview):**
|
|
478
|
+
|
|
479
|
+
| Platform | Property | Shape | Limits / Notes |
|
|
480
|
+
| --- | --- | --- | --- |
|
|
481
|
+
| Android (header templates) | `headerActions.android` | `{ startHeaderAction?, endHeaderActions? }` | `endHeaderActions`: 1–2 buttons. `startHeaderAction` can be `appIcon`/`back`/custom. |
|
|
482
|
+
| Android (MapTemplate) | `headerActions.android` | `ActionButton[]` | 1–4 action strip buttons. |
|
|
483
|
+
| iOS | `headerActions.ios` | `{ backButton?, leadingNavigationBarButtons?, trailingNavigationBarButtons? }` | Each list supports 1–2 buttons. `backButton` optional (system back is added if omitted). |
|
|
484
|
+
|
|
485
|
+
### Actions & Button Types (Quick Reference)
|
|
486
|
+
|
|
487
|
+
- **Android header actions** use `startHeaderAction` + `endHeaderActions`:
|
|
488
|
+
- `startHeaderAction`: `AppButton | BackButton | ActionButton`
|
|
489
|
+
- `endHeaderActions`: 1–2 buttons
|
|
490
|
+
- **If `headerActions` is omitted**: Android renders the **app icon** automatically.
|
|
491
|
+
- **iOS header actions** use:
|
|
492
|
+
- `backButton` (optional, otherwise iOS provides a default back action)
|
|
493
|
+
- `leadingNavigationBarButtons` (1–2)
|
|
494
|
+
- `trailingNavigationBarButtons` (1–2)
|
|
495
|
+
- **MapTemplate map buttons**: 1–4 buttons, including the special `pan` button.
|
|
496
|
+
|
|
497
|
+
### Event & Listener APIs
|
|
498
|
+
|
|
499
|
+
This section lists the available listeners and lifecycle callbacks so you can wire up connection state, visibility, cluster settings, and system events.
|
|
500
|
+
|
|
501
|
+
#### HybridAutoPlay listeners
|
|
502
|
+
|
|
503
|
+
| API | Payload | Notes |
|
|
504
|
+
| --- | --- | --- |
|
|
505
|
+
| `HybridAutoPlay.addListener(event, cb)` | event: `'didConnect'` `'didDisconnect'` | Connection changes for the head unit. |
|
|
506
|
+
| `HybridAutoPlay.addListenerRenderState(moduleName, cb)` | `cb(visibility: 'willAppear' \| 'didAppear' \| 'willDisappear' \| 'didDisappear')` | Use `AutoPlayModules.*` or a cluster UUID. |
|
|
507
|
+
| `HybridAutoPlay.addListenerVoiceInput(cb)` | `cb(location?, query?)` | Android-only voice input. |
|
|
508
|
+
| `HybridAutoPlay.addSafeAreaInsetsListener(moduleName, cb)` | `cb(insets)` | Safe area inset changes for any module. |
|
|
509
|
+
|
|
510
|
+
```ts
|
|
511
|
+
import { AutoPlayModules, HybridAutoPlay } from '@iternio/react-native-auto-play';
|
|
512
|
+
|
|
513
|
+
const cleanup = HybridAutoPlay.addListener('didConnect', () => {
|
|
514
|
+
console.log('Head unit connected');
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
const removeVisibility = HybridAutoPlay.addListenerRenderState(
|
|
518
|
+
AutoPlayModules.AutoPlayRoot,
|
|
519
|
+
(state) => console.log('AutoPlayRoot state', state)
|
|
520
|
+
);
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
#### Template lifecycle callbacks
|
|
524
|
+
|
|
525
|
+
All templates accept these lifecycle callbacks in their config:
|
|
526
|
+
|
|
527
|
+
- `onWillAppear(animated?)`
|
|
528
|
+
- `onDidAppear(animated?)`
|
|
529
|
+
- `onWillDisappear(animated?)`
|
|
530
|
+
- `onDidDisappear(animated?)`
|
|
531
|
+
- `onPopped()` (not supported on all iOS templates, see notes in code)
|
|
532
|
+
|
|
533
|
+
```ts
|
|
534
|
+
const template = new ListTemplate({
|
|
535
|
+
title: { text: 'Menu' },
|
|
536
|
+
onWillAppear: () => console.log('will appear'),
|
|
537
|
+
onPopped: () => console.log('popped forever'),
|
|
538
|
+
});
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
#### MapTemplate callbacks
|
|
542
|
+
|
|
543
|
+
Map-specific callbacks live on `MapTemplateConfig`:
|
|
544
|
+
|
|
545
|
+
- `onDidPan({ x, y })`
|
|
546
|
+
- `onDidUpdateZoomGestureWithCenter({ x, y }, scale)`
|
|
547
|
+
- `onClick({ x, y })` (Android)
|
|
548
|
+
- `onDoubleClick({ x, y })` (Android)
|
|
549
|
+
- `onAppearanceDidChange(colorScheme)`
|
|
550
|
+
- `onAutoDriveEnabled(template)` (Android)
|
|
551
|
+
- `onStopNavigation(template)` (**required**)
|
|
552
|
+
|
|
553
|
+
#### AutoPlayCluster listeners (instrument cluster)
|
|
554
|
+
|
|
555
|
+
| API | Payload | Notes |
|
|
556
|
+
| --- | --- | --- |
|
|
557
|
+
| `AutoPlayCluster.addListenerColorScheme(cb)` | `(clusterId, colorScheme)` | iOS + Android. |
|
|
558
|
+
| `AutoPlayCluster.addListenerZoom(cb)` | `(clusterId, zoomEvent)` | iOS only. |
|
|
559
|
+
| `AutoPlayCluster.addListenerCompass(cb)` | `(clusterId, enabled)` | iOS only. |
|
|
560
|
+
| `AutoPlayCluster.addListenerSpeedLimit(cb)` | `(clusterId, enabled)` | iOS only. |
|
|
561
|
+
|
|
562
|
+
```ts
|
|
563
|
+
const removeCompass = AutoPlayCluster.addListenerCompass((clusterId, enabled) => {
|
|
564
|
+
console.log('Cluster', clusterId, 'compass', enabled);
|
|
565
|
+
});
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
#### CarPlayDashboard listeners (iOS)
|
|
569
|
+
|
|
570
|
+
| API | Payload | Notes |
|
|
571
|
+
| --- | --- | --- |
|
|
572
|
+
| `CarPlayDashboard.addListener(event, cb)` | event: `'didConnect'` `'didDisconnect'` | Connection changes for the dashboard scene. |
|
|
573
|
+
| `CarPlayDashboard.addListenerRenderState(cb)` | `cb(visibility)` | Scene visibility changes. |
|
|
574
|
+
| `CarPlayDashboard.addListenerColorScheme(cb)` | `cb(colorScheme)` | Light/dark changes. |
|
|
575
|
+
|
|
350
576
|
### Localization
|
|
351
577
|
The library allows you to pass distances and durations and formats them according to the system defaults.
|
|
352
578
|
For iOS make sure to provide all supported app languages in Info.plist CFBundleLocalizations for this to work properly, missing languages will use CFBundleDevelopmentRegion as fallback which is **en** most of the time. This results in a mix up with the region which might result in **en**_AT instead of **de**_AT for example.
|
|
@@ -397,12 +623,33 @@ useEffect(() => {
|
|
|
397
623
|
|
|
398
624
|
### Templates
|
|
399
625
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
626
|
+
| Template | Purpose | Notes |
|
|
627
|
+
| --- | --- | --- |
|
|
628
|
+
| `MapTemplate` | Navigation, map rendering | Use as root; supports map buttons & navigation APIs. |
|
|
629
|
+
| `ListTemplate` | Lists/menus | Supports sections, radio/toggle rows. |
|
|
630
|
+
| `GridTemplate` | Action grid | Use `GridButton` items. |
|
|
631
|
+
| `SearchTemplate` | Search UI | Android-only search bar callbacks. |
|
|
632
|
+
| `InformationTemplate` | Info panels | Android uses PaneTemplate; iOS uses InformationTemplate. |
|
|
633
|
+
| `MessageTemplate` | Modal messages | Always shown on top until popped. |
|
|
634
|
+
|
|
635
|
+
**Template quick examples:**
|
|
636
|
+
|
|
637
|
+
```ts
|
|
638
|
+
// MapTemplate
|
|
639
|
+
const map = new MapTemplate({
|
|
640
|
+
component: MapScreen,
|
|
641
|
+
onStopNavigation: () => {},
|
|
642
|
+
headerActions: { android: [{ type: 'image', image: { name: 'list', type: 'glyph' }, onPress: () => {} }] },
|
|
643
|
+
});
|
|
644
|
+
map.setRootTemplate();
|
|
645
|
+
|
|
646
|
+
// ListTemplate
|
|
647
|
+
new ListTemplate({
|
|
648
|
+
title: { text: 'Destinations' },
|
|
649
|
+
sections: [{ type: 'default', title: 'Recent', items: [{ type: 'default', title: { text: 'Home' }, onPress: () => {} }] }],
|
|
650
|
+
headerActions: { android: { startHeaderAction: { type: 'back', onPress: () => {} } } },
|
|
651
|
+
}).push();
|
|
652
|
+
```
|
|
406
653
|
|
|
407
654
|
### Hooks
|
|
408
655
|
|
|
@@ -459,6 +706,31 @@ useEffect(() => {
|
|
|
459
706
|
- `CarPlayDashboard`: A component to render content on the CarPlay dashboard (CarPlay only).
|
|
460
707
|
- `AutoPlayCluster`: A component to render content on the instrument cluster (CarPlay & Android Auto).
|
|
461
708
|
|
|
709
|
+
**Scene APIs (overview):**
|
|
710
|
+
|
|
711
|
+
**CarPlayDashboard (iOS)**
|
|
712
|
+
- `setComponent(component)` — register the React component (call once).
|
|
713
|
+
- `setButtons(buttons)` — **required** to make the dashboard visible.
|
|
714
|
+
- `addListener(event, cb)` — `didConnect` / `didDisconnect`.
|
|
715
|
+
- `addListenerRenderState(cb)` — scene visibility callbacks.
|
|
716
|
+
- `addListenerColorScheme(cb)` — light/dark changes.
|
|
717
|
+
|
|
718
|
+
```ts
|
|
719
|
+
CarPlayDashboard.setButtons([
|
|
720
|
+
{
|
|
721
|
+
titleVariants: ['Open App'],
|
|
722
|
+
subtitleVariants: ['Dashboard shortcut'],
|
|
723
|
+
image: { name: 'directions_car', type: 'glyph' },
|
|
724
|
+
onPress: () => console.log('open app'),
|
|
725
|
+
},
|
|
726
|
+
]);
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
**AutoPlayCluster**
|
|
730
|
+
- `setComponent(component)` — register the cluster component.
|
|
731
|
+
- `setAttributedInactiveDescriptionVariants(variants)` — iOS only inactive text.
|
|
732
|
+
- `addListenerColorScheme(cb)` / `addListenerZoom(cb)` / `addListenerCompass(cb)` / `addListenerSpeedLimit(cb)`.
|
|
733
|
+
|
|
462
734
|
## Known Issues
|
|
463
735
|
|
|
464
736
|
### iOS
|
|
@@ -485,4 +757,3 @@ Contributions are welcome! Please submit a pull request.
|
|
|
485
757
|
## License
|
|
486
758
|
|
|
487
759
|
This project is licensed under the MIT License - see the [LICENSE](../../LICENSE.md) file for details.
|
|
488
|
-
|
|
@@ -96,6 +96,9 @@ class AutoPlayInterfaceController: NSObject, CPInterfaceControllerDelegate {
|
|
|
96
96
|
templateIds.append(templateId)
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
if templateIds.count == 0 {
|
|
100
|
+
return templateIds
|
|
101
|
+
}
|
|
99
102
|
try await interfaceController.popToRootTemplate(
|
|
100
103
|
animated: animated
|
|
101
104
|
)
|
|
@@ -44,8 +44,11 @@ class HeadUnitSceneDelegate: AutoPlayScene, CPTemplateApplicationSceneDelegate {
|
|
|
44
44
|
self.interfaceController = AutoPlayInterfaceController(
|
|
45
45
|
interfaceController: interfaceController
|
|
46
46
|
)
|
|
47
|
-
|
|
48
|
-
connect(props: [
|
|
47
|
+
|
|
48
|
+
connect(props: [
|
|
49
|
+
"colorScheme": interfaceController.carTraitCollection
|
|
50
|
+
.userInterfaceStyle == .dark ? "dark" : "light"
|
|
51
|
+
])
|
|
49
52
|
HybridAutoPlay.emit(event: .didconnect)
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -44,6 +44,11 @@ class MapTemplate: NSObject, AutoPlayTemplate, AutoPlayHeaderProviding,
|
|
|
44
44
|
var currentTripId: String?
|
|
45
45
|
|
|
46
46
|
var tripSelectorVisible = false
|
|
47
|
+
/**
|
|
48
|
+
this avoids a race condition when invalidating the template that causes an App Hang (main‑thread stall)
|
|
49
|
+
when using CPMapTemplate.isPanningInterfaceVisible
|
|
50
|
+
*/
|
|
51
|
+
private var isPanningInterfaceVisible = false
|
|
47
52
|
|
|
48
53
|
init(config: MapTemplateConfig) {
|
|
49
54
|
self.config = config
|
|
@@ -68,7 +73,7 @@ class MapTemplate: NSObject, AutoPlayTemplate, AutoPlayHeaderProviding,
|
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
func onPanButtonPress() {
|
|
71
|
-
if
|
|
76
|
+
if isPanningInterfaceVisible {
|
|
72
77
|
template.dismissPanningInterface(animated: true)
|
|
73
78
|
} else {
|
|
74
79
|
template.showPanningInterface(animated: true)
|
|
@@ -125,7 +130,7 @@ class MapTemplate: NSObject, AutoPlayTemplate, AutoPlayHeaderProviding,
|
|
|
125
130
|
return
|
|
126
131
|
}
|
|
127
132
|
|
|
128
|
-
if
|
|
133
|
+
if isPanningInterfaceVisible {
|
|
129
134
|
// while panning interface is shown we only provide a back button on the header
|
|
130
135
|
// and all map buttons except the pan button
|
|
131
136
|
// reason is that you can have a max of 2 map buttons while panning interface is shown
|
|
@@ -207,7 +212,7 @@ class MapTemplate: NSObject, AutoPlayTemplate, AutoPlayHeaderProviding,
|
|
|
207
212
|
scale: CGFloat,
|
|
208
213
|
velocity: CGFloat
|
|
209
214
|
) {
|
|
210
|
-
if
|
|
215
|
+
if isPanningInterfaceVisible {
|
|
211
216
|
return
|
|
212
217
|
}
|
|
213
218
|
|
|
@@ -223,11 +228,12 @@ class MapTemplate: NSObject, AutoPlayTemplate, AutoPlayHeaderProviding,
|
|
|
223
228
|
}
|
|
224
229
|
|
|
225
230
|
func mapTemplateDidShowPanningInterface(_ mapTemplate: CPMapTemplate) {
|
|
231
|
+
isPanningInterfaceVisible = true
|
|
226
232
|
config.onDidChangePanningInterface?(true)
|
|
227
233
|
invalidate()
|
|
228
234
|
}
|
|
229
|
-
|
|
230
235
|
func mapTemplateDidDismissPanningInterface(_ mapTemplate: CPMapTemplate) {
|
|
236
|
+
isPanningInterfaceVisible = false
|
|
231
237
|
config.onDidChangePanningInterface?(false)
|
|
232
238
|
invalidate()
|
|
233
239
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A hook to determine if the CarPlay/Android Auto screen is currently focused (visible).
|
|
3
|
+
*
|
|
4
|
+
* @param moduleName The name of the module to listen to.
|
|
5
|
+
* @returns `true` if the screen is focused, `false` otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useIsAutoPlayFocused(moduleName: string): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { HybridAutoPlay } from '..';
|
|
3
|
+
/**
|
|
4
|
+
* A hook to determine if the CarPlay/Android Auto screen is currently focused (visible).
|
|
5
|
+
*
|
|
6
|
+
* @param moduleName The name of the module to listen to.
|
|
7
|
+
* @returns `true` if the screen is focused, `false` otherwise.
|
|
8
|
+
*/
|
|
9
|
+
export function useIsAutoPlayFocused(moduleName) {
|
|
10
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const remove = HybridAutoPlay.addListenerRenderState(moduleName, (state) => {
|
|
13
|
+
setIsFocused(state === 'didAppear');
|
|
14
|
+
});
|
|
15
|
+
return () => {
|
|
16
|
+
remove();
|
|
17
|
+
};
|
|
18
|
+
}, [moduleName]);
|
|
19
|
+
return isFocused;
|
|
20
|
+
}
|
package/lib/hybrid.d.ts
ADDED
package/lib/hybrid.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NitroAutomotivePermissionRequestTemplateConfig } from '../templates/AutomotivePermissionRequestTemplate';
|
|
3
|
+
import type { NitroTemplateConfig } from './AutoPlay.nitro';
|
|
4
|
+
interface AutomotivePermissionRequestTemplateConfig extends NitroTemplateConfig, NitroAutomotivePermissionRequestTemplateConfig {
|
|
5
|
+
}
|
|
6
|
+
export interface AutomotivePermissionRequestTemplate extends HybridObject<{
|
|
7
|
+
android: 'kotlin';
|
|
8
|
+
}> {
|
|
9
|
+
createAutomotivePermissionRequestTemplate(config: AutomotivePermissionRequestTemplateConfig): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NitroAutomotivePermissionRequestTemplateConfig } from '../templates/AutomotivePermissionRequestTemplate';
|
|
3
|
+
import type { NitroTemplateConfig } from './AutoPlay.nitro';
|
|
4
|
+
interface AutomotivePermissionRequestTemplateConfig extends NitroTemplateConfig, NitroAutomotivePermissionRequestTemplateConfig {
|
|
5
|
+
}
|
|
6
|
+
export interface AutomotivePermissionRequestTemplate extends HybridObject<{
|
|
7
|
+
android: 'kotlin';
|
|
8
|
+
}> {
|
|
9
|
+
createAutomotivePermissionRequestTemplate(config: AutomotivePermissionRequestTemplateConfig): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NitroSignInTemplateConfig } from '../templates/SignInTemplate';
|
|
3
|
+
import type { NitroTemplateConfig } from './AutoPlay.nitro';
|
|
4
|
+
interface SignInTemplateConfig extends NitroTemplateConfig, NitroSignInTemplateConfig {
|
|
5
|
+
}
|
|
6
|
+
export interface SignInTemplate extends HybridObject<{
|
|
7
|
+
android: 'kotlin';
|
|
8
|
+
}> {
|
|
9
|
+
createSignInTemplate(config: SignInTemplateConfig): void;
|
|
10
|
+
updateTemplate(templateId: string, config: SignInTemplateConfig): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CustomActionButtonAndroid } from '../types/Button';
|
|
2
|
+
import type { AutoText } from '../types/Text';
|
|
3
|
+
import { type NitroAction } from '../utils/NitroAction';
|
|
4
|
+
import { type HeaderActions, Template, type TemplateConfig } from './Template';
|
|
5
|
+
export interface NitroAutomotivePermissionRequestTemplateConfig extends TemplateConfig {
|
|
6
|
+
headerActions?: Array<NitroAction>;
|
|
7
|
+
title: AutoText;
|
|
8
|
+
actions: Array<NitroAction>;
|
|
9
|
+
}
|
|
10
|
+
export type AutomotivePermissionRequestTemplateConfig = Omit<NitroAutomotivePermissionRequestTemplateConfig, 'headerActions' | 'buttons'> & {
|
|
11
|
+
/**
|
|
12
|
+
* action buttons, usually at the the top right on Android and a top bar on iOS
|
|
13
|
+
*/
|
|
14
|
+
headerActions?: HeaderActions<AutomotivePermissionRequestTemplate>;
|
|
15
|
+
actions: [CustomActionButtonAndroid<AutomotivePermissionRequestTemplate>] | [
|
|
16
|
+
CustomActionButtonAndroid<AutomotivePermissionRequestTemplate>,
|
|
17
|
+
CustomActionButtonAndroid<AutomotivePermissionRequestTemplate>
|
|
18
|
+
];
|
|
19
|
+
};
|
|
20
|
+
export declare class AutomotivePermissionRequestTemplate extends Template<AutomotivePermissionRequestTemplateConfig, HeaderActions<AutomotivePermissionRequestTemplate>> {
|
|
21
|
+
private template;
|
|
22
|
+
constructor(config: AutomotivePermissionRequestTemplateConfig);
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
2
|
+
import { NitroActionUtil } from '../utils/NitroAction';
|
|
3
|
+
import { Template, } from './Template';
|
|
4
|
+
const HybridAutomotivePermissionRequestTemplate = NitroModules.createHybridObject('AutomotivePermissionRequestTemplate');
|
|
5
|
+
export class AutomotivePermissionRequestTemplate extends Template {
|
|
6
|
+
template = this;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
super(config);
|
|
9
|
+
const { headerActions, actions, ...rest } = config;
|
|
10
|
+
const nitroConfig = {
|
|
11
|
+
...rest,
|
|
12
|
+
id: this.id,
|
|
13
|
+
headerActions: NitroActionUtil.convert(this.template, headerActions),
|
|
14
|
+
actions: NitroActionUtil.convert(this.template, actions),
|
|
15
|
+
};
|
|
16
|
+
HybridAutomotivePermissionRequestTemplate.createAutomotivePermissionRequestTemplate(nitroConfig);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ActionButton, AppButton, BackButton, CustomActionButtonAndroid, ImageButton } from '..';
|
|
2
|
+
import type { SignInTemplate as NitroSignInTemplate } from '../specs/SignInTemplate.nitro';
|
|
3
|
+
import { type SignInMethod } from '../types/SignInMethod';
|
|
4
|
+
import { type NitroAction } from '../utils/NitroAction';
|
|
5
|
+
import { Template, type TemplateConfig } from './Template';
|
|
6
|
+
export declare const HybridSignInTemplate: NitroSignInTemplate | null;
|
|
7
|
+
export interface NitroSignInTemplateConfig extends TemplateConfig {
|
|
8
|
+
title?: string;
|
|
9
|
+
additionalText?: string;
|
|
10
|
+
signInMethod?: SignInMethod;
|
|
11
|
+
headerActions?: Array<NitroAction>;
|
|
12
|
+
actions?: Array<NitroAction>;
|
|
13
|
+
instructions?: string;
|
|
14
|
+
}
|
|
15
|
+
export type SignInHeaderActions<T> = {
|
|
16
|
+
android: {
|
|
17
|
+
startHeaderAction?: AppButton | BackButton<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Actions for the sign-in template.
|
|
20
|
+
* Note: Android Auto only allows 1 action with a custom title in the action strip.
|
|
21
|
+
*/
|
|
22
|
+
endHeaderActions?: [CustomActionButtonAndroid<SignInTemplate>, ImageButton<SignInTemplate>] | [ImageButton<SignInTemplate>, CustomActionButtonAndroid<SignInTemplate>] | [CustomActionButtonAndroid<SignInTemplate>];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type SignInTemplateConfig = Omit<NitroSignInTemplateConfig, 'headerActions' | 'actions' | 'signInMethod'> & {
|
|
26
|
+
headerActions?: SignInHeaderActions<SignInTemplate>;
|
|
27
|
+
actions?: Array<ActionButton<SignInTemplate>>;
|
|
28
|
+
signInMethod: SignInMethod;
|
|
29
|
+
};
|
|
30
|
+
export type SignInTemplateUpdateConfig = Omit<NitroSignInTemplateConfig, 'headerActions' | 'actions'> & {
|
|
31
|
+
headerActions?: SignInHeaderActions<SignInTemplate>;
|
|
32
|
+
actions?: Array<ActionButton<SignInTemplate>>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A template for signing in to an account.
|
|
36
|
+
* @namespace Android
|
|
37
|
+
*/
|
|
38
|
+
export declare class SignInTemplate extends Template<SignInTemplateConfig, SignInHeaderActions<SignInTemplate>> {
|
|
39
|
+
private template;
|
|
40
|
+
constructor(config: SignInTemplateConfig);
|
|
41
|
+
/**
|
|
42
|
+
* Updates the template with new config. The config is merged with the current one,
|
|
43
|
+
* so if values are not provided, they will stay. To change values, they need to be overridden.
|
|
44
|
+
*
|
|
45
|
+
* @param updatedConfig - The updated config for the template.
|
|
46
|
+
* @returns A promise that resolves when the template is updated.
|
|
47
|
+
*/
|
|
48
|
+
updateTemplate(updatedConfig: SignInTemplateUpdateConfig): Promise<void> | undefined;
|
|
49
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
3
|
+
import { SignInMethods } from '../types/SignInMethod';
|
|
4
|
+
import { NitroActionUtil } from '../utils/NitroAction';
|
|
5
|
+
import { Template } from './Template';
|
|
6
|
+
export const HybridSignInTemplate = Platform.OS === 'android'
|
|
7
|
+
? NitroModules.createHybridObject('SignInTemplate')
|
|
8
|
+
: null;
|
|
9
|
+
/**
|
|
10
|
+
* A template for signing in to an account.
|
|
11
|
+
* @namespace Android
|
|
12
|
+
*/
|
|
13
|
+
export class SignInTemplate extends Template {
|
|
14
|
+
template = this;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
super(config);
|
|
17
|
+
const { headerActions, actions, ...rest } = config;
|
|
18
|
+
const nitroConfig = {
|
|
19
|
+
...rest,
|
|
20
|
+
id: this.id,
|
|
21
|
+
headerActions: NitroActionUtil.convert(this.template, headerActions),
|
|
22
|
+
actions: NitroActionUtil.convert(this.template, actions),
|
|
23
|
+
};
|
|
24
|
+
if (config.signInMethod.method === SignInMethods.PIN &&
|
|
25
|
+
(config.signInMethod.pin?.length > 12 || config.signInMethod.pin?.length < 1)) {
|
|
26
|
+
throw new Error('PIN must be 1-12 characters');
|
|
27
|
+
}
|
|
28
|
+
HybridSignInTemplate?.createSignInTemplate(nitroConfig);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Updates the template with new config. The config is merged with the current one,
|
|
32
|
+
* so if values are not provided, they will stay. To change values, they need to be overridden.
|
|
33
|
+
*
|
|
34
|
+
* @param updatedConfig - The updated config for the template.
|
|
35
|
+
* @returns A promise that resolves when the template is updated.
|
|
36
|
+
*/
|
|
37
|
+
updateTemplate(updatedConfig) {
|
|
38
|
+
const { headerActions, actions, ...rest } = updatedConfig;
|
|
39
|
+
const nitroConfig = {
|
|
40
|
+
...rest,
|
|
41
|
+
id: this.id,
|
|
42
|
+
headerActions: NitroActionUtil.convert(this.template, headerActions),
|
|
43
|
+
actions: NitroActionUtil.convert(this.template, actions),
|
|
44
|
+
};
|
|
45
|
+
if (nitroConfig.signInMethod?.method === SignInMethods.PIN &&
|
|
46
|
+
(nitroConfig.signInMethod.pin?.length > 12 || nitroConfig.signInMethod.pin?.length < 1)) {
|
|
47
|
+
throw new Error('PIN must be 1-12 characters');
|
|
48
|
+
}
|
|
49
|
+
return HybridSignInTemplate?.updateTemplate(this.id, nitroConfig);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare enum SignInMethods {
|
|
2
|
+
QR = 0,
|
|
3
|
+
PROVIDER = 1,
|
|
4
|
+
PIN = 2,
|
|
5
|
+
INPUT = 3
|
|
6
|
+
}
|
|
7
|
+
export type PinSignIn = {
|
|
8
|
+
method: SignInMethods.PIN;
|
|
9
|
+
/**
|
|
10
|
+
* PIN code for sign-in. Must be 1-12 characters.
|
|
11
|
+
*/
|
|
12
|
+
pin: string;
|
|
13
|
+
};
|
|
14
|
+
export declare enum KeyboardType {
|
|
15
|
+
DEFAULT = 0,
|
|
16
|
+
EMAIL = 1,
|
|
17
|
+
PHONE = 2,
|
|
18
|
+
NUMBER = 3
|
|
19
|
+
}
|
|
20
|
+
export declare enum TextInputType {
|
|
21
|
+
PASSWORD = 0,
|
|
22
|
+
DEFAULT = 1
|
|
23
|
+
}
|
|
24
|
+
export type InputSignIn = {
|
|
25
|
+
method: SignInMethods.INPUT;
|
|
26
|
+
keyboardType?: KeyboardType;
|
|
27
|
+
hint?: string;
|
|
28
|
+
defaultValue?: string;
|
|
29
|
+
errorMessage?: string;
|
|
30
|
+
callback: (text: string) => void;
|
|
31
|
+
showKeyboardByDefault?: boolean;
|
|
32
|
+
inputType: TextInputType;
|
|
33
|
+
};
|
|
34
|
+
export type QrSignIn = {
|
|
35
|
+
method: SignInMethods.QR;
|
|
36
|
+
url: string;
|
|
37
|
+
};
|
|
38
|
+
export type SignInMethod = QrSignIn | PinSignIn | InputSignIn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export var SignInMethods;
|
|
2
|
+
(function (SignInMethods) {
|
|
3
|
+
SignInMethods[SignInMethods["QR"] = 0] = "QR";
|
|
4
|
+
SignInMethods[SignInMethods["PROVIDER"] = 1] = "PROVIDER";
|
|
5
|
+
SignInMethods[SignInMethods["PIN"] = 2] = "PIN";
|
|
6
|
+
SignInMethods[SignInMethods["INPUT"] = 3] = "INPUT";
|
|
7
|
+
})(SignInMethods || (SignInMethods = {}));
|
|
8
|
+
export var KeyboardType;
|
|
9
|
+
(function (KeyboardType) {
|
|
10
|
+
KeyboardType[KeyboardType["DEFAULT"] = 0] = "DEFAULT";
|
|
11
|
+
KeyboardType[KeyboardType["EMAIL"] = 1] = "EMAIL";
|
|
12
|
+
KeyboardType[KeyboardType["PHONE"] = 2] = "PHONE";
|
|
13
|
+
KeyboardType[KeyboardType["NUMBER"] = 3] = "NUMBER";
|
|
14
|
+
})(KeyboardType || (KeyboardType = {}));
|
|
15
|
+
export var TextInputType;
|
|
16
|
+
(function (TextInputType) {
|
|
17
|
+
TextInputType[TextInputType["PASSWORD"] = 0] = "PASSWORD";
|
|
18
|
+
TextInputType[TextInputType["DEFAULT"] = 1] = "DEFAULT";
|
|
19
|
+
})(TextInputType || (TextInputType = {}));
|
|
@@ -57,7 +57,7 @@ data class GridTemplateConfig(
|
|
|
57
57
|
constructor(id: String, onWillAppear: ((animated: Boolean?) -> Unit)?, onWillDisappear: ((animated: Boolean?) -> Unit)?, onDidAppear: ((animated: Boolean?) -> Unit)?, onDidDisappear: ((animated: Boolean?) -> Unit)?, onPopped: (() -> Unit)?, autoDismissMs: Double?, headerActions: Array<NitroAction>?, title: AutoText, buttons: Array<NitroGridButton>, mapConfig: NitroBaseMapTemplateConfig?):
|
|
58
58
|
this(id, onWillAppear?.let { Func_void_std__optional_bool__java(it) }, onWillDisappear?.let { Func_void_std__optional_bool__java(it) }, onDidAppear?.let { Func_void_std__optional_bool__java(it) }, onDidDisappear?.let { Func_void_std__optional_bool__java(it) }, onPopped?.let { Func_void_java(it) }, autoDismissMs, headerActions, title, buttons, mapConfig)
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
companion object {
|
|
61
61
|
/**
|
|
62
62
|
* Constructor called from C++
|
|
63
63
|
*/
|
|
@@ -60,7 +60,7 @@ data class InformationTemplateConfig(
|
|
|
60
60
|
constructor(id: String, onWillAppear: ((animated: Boolean?) -> Unit)?, onWillDisappear: ((animated: Boolean?) -> Unit)?, onDidAppear: ((animated: Boolean?) -> Unit)?, onDidDisappear: ((animated: Boolean?) -> Unit)?, onPopped: (() -> Unit)?, autoDismissMs: Double?, headerActions: Array<NitroAction>?, title: AutoText, section: NitroSection, actions: Array<NitroAction>?, mapConfig: NitroBaseMapTemplateConfig?):
|
|
61
61
|
this(id, onWillAppear?.let { Func_void_std__optional_bool__java(it) }, onWillDisappear?.let { Func_void_std__optional_bool__java(it) }, onDidAppear?.let { Func_void_std__optional_bool__java(it) }, onDidDisappear?.let { Func_void_std__optional_bool__java(it) }, onPopped?.let { Func_void_java(it) }, autoDismissMs, headerActions, title, section, actions, mapConfig)
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
companion object {
|
|
64
64
|
/**
|
|
65
65
|
* Constructor called from C++
|
|
66
66
|
*/
|
|
@@ -57,7 +57,7 @@ data class ListTemplateConfig(
|
|
|
57
57
|
constructor(id: String, onWillAppear: ((animated: Boolean?) -> Unit)?, onWillDisappear: ((animated: Boolean?) -> Unit)?, onDidAppear: ((animated: Boolean?) -> Unit)?, onDidDisappear: ((animated: Boolean?) -> Unit)?, onPopped: (() -> Unit)?, autoDismissMs: Double?, headerActions: Array<NitroAction>?, title: AutoText, sections: Array<NitroSection>?, mapConfig: NitroBaseMapTemplateConfig?):
|
|
58
58
|
this(id, onWillAppear?.let { Func_void_std__optional_bool__java(it) }, onWillDisappear?.let { Func_void_std__optional_bool__java(it) }, onDidAppear?.let { Func_void_std__optional_bool__java(it) }, onDidDisappear?.let { Func_void_std__optional_bool__java(it) }, onPopped?.let { Func_void_java(it) }, autoDismissMs, headerActions, title, sections, mapConfig)
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
companion object {
|
|
61
61
|
/**
|
|
62
62
|
* Constructor called from C++
|
|
63
63
|
*/
|
|
@@ -81,7 +81,7 @@ data class MapTemplateConfig(
|
|
|
81
81
|
constructor(id: String, onWillAppear: ((animated: Boolean?) -> Unit)?, onWillDisappear: ((animated: Boolean?) -> Unit)?, onDidAppear: ((animated: Boolean?) -> Unit)?, onDidDisappear: ((animated: Boolean?) -> Unit)?, onPopped: (() -> Unit)?, autoDismissMs: Double?, visibleTravelEstimate: VisibleTravelEstimate?, onDidPan: ((translation: Point, velocity: Point?) -> Unit)?, onDidUpdateZoomGestureWithCenter: ((center: Point, scale: Double) -> Unit)?, onClick: ((center: Point) -> Unit)?, onDoubleClick: ((center: Point) -> Unit)?, onAppearanceDidChange: ((colorScheme: ColorScheme) -> Unit)?, onStopNavigation: () -> Unit, onAutoDriveEnabled: (() -> Unit)?, mapButtons: Array<NitroMapButton>?, headerActions: Array<NitroAction>?, panButtonScrollPercentage: Double?, onDidChangePanningInterface: ((isPanningInterfaceVisible: Boolean) -> Unit)?):
|
|
82
82
|
this(id, onWillAppear?.let { Func_void_std__optional_bool__java(it) }, onWillDisappear?.let { Func_void_std__optional_bool__java(it) }, onDidAppear?.let { Func_void_std__optional_bool__java(it) }, onDidDisappear?.let { Func_void_std__optional_bool__java(it) }, onPopped?.let { Func_void_java(it) }, autoDismissMs, visibleTravelEstimate, onDidPan?.let { Func_void_Point_std__optional_Point__java(it) }, onDidUpdateZoomGestureWithCenter?.let { Func_void_Point_double_java(it) }, onClick?.let { Func_void_Point_java(it) }, onDoubleClick?.let { Func_void_Point_java(it) }, onAppearanceDidChange?.let { Func_void_ColorScheme_java(it) }, Func_void_java(onStopNavigation), onAutoDriveEnabled?.let { Func_void_java(it) }, mapButtons, headerActions, panButtonScrollPercentage, onDidChangePanningInterface?.let { Func_void_bool_java(it) })
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
companion object {
|
|
85
85
|
/**
|
|
86
86
|
* Constructor called from C++
|
|
87
87
|
*/
|
|
@@ -63,7 +63,7 @@ data class MessageTemplateConfig(
|
|
|
63
63
|
constructor(id: String, onWillAppear: ((animated: Boolean?) -> Unit)?, onWillDisappear: ((animated: Boolean?) -> Unit)?, onDidAppear: ((animated: Boolean?) -> Unit)?, onDidDisappear: ((animated: Boolean?) -> Unit)?, onPopped: (() -> Unit)?, autoDismissMs: Double?, headerActions: Array<NitroAction>?, title: AutoText?, message: AutoText, actions: Array<NitroAction>?, image: Variant_GlyphImage_AssetImage?, mapConfig: NitroBaseMapTemplateConfig?):
|
|
64
64
|
this(id, onWillAppear?.let { Func_void_std__optional_bool__java(it) }, onWillDisappear?.let { Func_void_std__optional_bool__java(it) }, onDidAppear?.let { Func_void_std__optional_bool__java(it) }, onDidDisappear?.let { Func_void_std__optional_bool__java(it) }, onPopped?.let { Func_void_java(it) }, autoDismissMs, headerActions, title, message, actions, image, mapConfig)
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
companion object {
|
|
67
67
|
/**
|
|
68
68
|
* Constructor called from C++
|
|
69
69
|
*/
|
|
@@ -48,7 +48,7 @@ data class NitroAction(
|
|
|
48
48
|
constructor(title: String?, image: Variant_GlyphImage_AssetImage?, enabled: Boolean?, onPress: () -> Unit, type: NitroActionType, alignment: NitroAlignment?, flags: Double?, style: NitroButtonStyle?):
|
|
49
49
|
this(title, image, enabled, Func_void_java(onPress), type, alignment, flags, style)
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
companion object {
|
|
52
52
|
/**
|
|
53
53
|
* Constructor called from C++
|
|
54
54
|
*/
|
|
@@ -51,7 +51,7 @@ data class NitroBaseMapTemplateConfig(
|
|
|
51
51
|
constructor(mapButtons: Array<NitroMapButton>?, headerActions: Array<NitroAction>?, onDidChangePanningInterface: ((isPanningInterfaceVisible: Boolean) -> Unit)?, onWillAppear: ((animated: Boolean?) -> Unit)?, onWillDisappear: ((animated: Boolean?) -> Unit)?, onDidAppear: ((animated: Boolean?) -> Unit)?, onDidDisappear: ((animated: Boolean?) -> Unit)?, onPopped: (() -> Unit)?, autoDismissMs: Double?):
|
|
52
52
|
this(mapButtons, headerActions, onDidChangePanningInterface?.let { Func_void_bool_java(it) }, onWillAppear?.let { Func_void_std__optional_bool__java(it) }, onWillDisappear?.let { Func_void_std__optional_bool__java(it) }, onDidAppear?.let { Func_void_std__optional_bool__java(it) }, onDidDisappear?.let { Func_void_std__optional_bool__java(it) }, onPopped?.let { Func_void_java(it) }, autoDismissMs)
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
companion object {
|
|
55
55
|
/**
|
|
56
56
|
* Constructor called from C++
|
|
57
57
|
*/
|
|
@@ -33,7 +33,7 @@ data class NitroMapButton(
|
|
|
33
33
|
constructor(type: NitroMapButtonType, image: NitroImage, onPress: (() -> Unit)?):
|
|
34
34
|
this(type, image, onPress?.let { Func_void_java(it) })
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
companion object {
|
|
37
37
|
/**
|
|
38
38
|
* Constructor called from C++
|
|
39
39
|
*/
|
|
@@ -54,7 +54,7 @@ data class NitroNavigationAlert(
|
|
|
54
54
|
constructor(id: Double, title: AutoText, subtitle: AutoText?, image: Variant_GlyphImage_AssetImage?, primaryAction: NavigationAlertAction, secondaryAction: NavigationAlertAction?, durationMs: Double, onWillShow: (() -> Unit)?, onDidDismiss: ((reason: AlertDismissalReason) -> Unit)?, priority: Double):
|
|
55
55
|
this(id, title, subtitle, image, primaryAction, secondaryAction, durationMs, onWillShow?.let { Func_void_java(it) }, onDidDismiss?.let { Func_void_AlertDismissalReason_java(it) }, priority)
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
companion object {
|
|
58
58
|
/**
|
|
59
59
|
* Constructor called from C++
|
|
60
60
|
*/
|
|
@@ -48,7 +48,7 @@ data class NitroRow(
|
|
|
48
48
|
constructor(title: AutoText, detailedText: AutoText?, browsable: Boolean?, enabled: Boolean, image: Variant_GlyphImage_AssetImage?, checked: Boolean?, onPress: ((checked: Boolean?) -> Unit)?, selected: Boolean?):
|
|
49
49
|
this(title, detailedText, browsable, enabled, image, checked, onPress?.let { Func_void_std__optional_bool__java(it) }, selected)
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
companion object {
|
|
52
52
|
/**
|
|
53
53
|
* Constructor called from C++
|
|
54
54
|
*/
|
|
@@ -66,7 +66,7 @@ data class SearchTemplateConfig(
|
|
|
66
66
|
constructor(id: String, onWillAppear: ((animated: Boolean?) -> Unit)?, onWillDisappear: ((animated: Boolean?) -> Unit)?, onDidAppear: ((animated: Boolean?) -> Unit)?, onDidDisappear: ((animated: Boolean?) -> Unit)?, onPopped: (() -> Unit)?, autoDismissMs: Double?, headerActions: Array<NitroAction>?, title: AutoText, results: NitroSection, initialSearchText: String?, searchHint: String?, onSearchTextChanged: (searchText: String) -> Unit, onSearchTextSubmitted: (searchText: String) -> Unit):
|
|
67
67
|
this(id, onWillAppear?.let { Func_void_std__optional_bool__java(it) }, onWillDisappear?.let { Func_void_std__optional_bool__java(it) }, onDidAppear?.let { Func_void_std__optional_bool__java(it) }, onDidDisappear?.let { Func_void_std__optional_bool__java(it) }, onPopped?.let { Func_void_java(it) }, autoDismissMs, headerActions, title, results, initialSearchText, searchHint, Func_void_std__string_java(onSearchTextChanged), Func_void_std__string_java(onSearchTextSubmitted))
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
companion object {
|
|
70
70
|
/**
|
|
71
71
|
* Constructor called from C++
|
|
72
72
|
*/
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
-
import type { CleanupCallback } from '../types/Event';
|
|
3
|
-
export interface VoiceInput extends HybridObject<{
|
|
4
|
-
android: 'kotlin';
|
|
5
|
-
ios: 'swift';
|
|
6
|
-
}> {
|
|
7
|
-
registerVoiceInputListener(callback: (voiceInputResult?: string, error?: string) => void): CleanupCallback;
|
|
8
|
-
}
|
|
File without changes
|