@iternio/react-native-auto-play 0.2.0-alpha.8 → 0.2.0
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 +8 -1
- package/package.json +1 -1
- package/lib/hooks/useIsAutoPlayFocused.d.ts +0 -7
- package/lib/hooks/useIsAutoPlayFocused.js +0 -20
- package/lib/hybrid.d.ts +0 -2
- package/lib/hybrid.js +0 -2
- package/lib/specs/AutomotivePermissionRequestTemplate.d.ts +0 -11
- package/lib/specs/AutomotivePermissionRequestTemplate.js +0 -1
- package/lib/specs/AutomotivePermissionRequestTemplate.nitro.d.ts +0 -11
- package/lib/specs/AutomotivePermissionRequestTemplate.nitro.js +0 -1
- package/lib/templates/AutomotivePermissionRequestTemplate.d.ts +0 -23
- package/lib/templates/AutomotivePermissionRequestTemplate.js +0 -18
package/README.md
CHANGED
|
@@ -292,6 +292,11 @@ To get rid of your default activity, do an automotive specific build variant and
|
|
|
292
292
|
```
|
|
293
293
|
For details check the example app and its build variants.
|
|
294
294
|
|
|
295
|
+
#### Non-template Automotive app ####
|
|
296
|
+
|
|
297
|
+
The library can also be used for Android Automotive apps that do not make use of templates. In case you do a navigation app HybridAndroidAutomotive provides methods to monitor and request the app focus to let the system know your app is taking over the navigation focus.
|
|
298
|
+
Do not use app focus related functions on template applications as it fights with the navigation manager used on the map template.
|
|
299
|
+
|
|
295
300
|
#### A Note on Android Studio
|
|
296
301
|
|
|
297
302
|
When using build variants, Android Studio may not be aware of the selected variant during a Gradle sync. This can cause the IDE to show the incorrect implementation of native classes like `AndroidTelemetryObserver` (e.g., it might show the Android Auto version instead of the Automotive version).
|
|
@@ -452,7 +457,7 @@ Below is a concise overview of the most important props per template. Optional p
|
|
|
452
457
|
| `component` | `React.ComponentType<RootComponentInitialProps>` | ✅ | React component to render on the map surface. |
|
|
453
458
|
| `onStopNavigation` | `(template: MapTemplate) => void` | ✅ | Called when navigation is stopped by the system. |
|
|
454
459
|
| `headerActions` | `MapHeaderActions<MapTemplate>` | ❌ | Top action strip. See **Header Actions** below. |
|
|
455
|
-
| `mapButtons` | `MapButtons<MapTemplate>` | ❌ | 1–4 map buttons shown on the map. |
|
|
460
|
+
| `mapButtons` | `MapButtons<MapTemplate>` | ❌ | 1–4 map buttons shown on the map. To get working gestures on the MapTemplate running on Android Auto you have to add a `MapPanButton` |
|
|
456
461
|
| `visibleTravelEstimate` | `'first'` `'last'` | ❌ | Which travel estimate to display. |
|
|
457
462
|
| `onDidPan` / `onDidUpdateZoomGestureWithCenter` | callbacks | ❌ | Map gesture events. |
|
|
458
463
|
| `onAppearanceDidChange` | `(colorScheme) => void` | ❌ | Listen for light/dark mode changes. |
|
|
@@ -893,6 +898,8 @@ CarPlayDashboard.setButtons([
|
|
|
893
898
|
- **Broken exceptions with `react-native`** up to version 0.79
|
|
894
899
|
When using react-native before 0.80.0 exceptions are broken and are reported as `Unknown runtime_error` or similar.
|
|
895
900
|
See [this issue](https://github.com/mrousavy/nitro/issues/382) for details.
|
|
901
|
+
- **@rnmapbox/maps** The map view/camera might take the primary screens scale factor into account when interacting with the map.
|
|
902
|
+
This might lead to broken gestures, in case you face this issue try to apply either the `Dimensions.get('window').scale` or `RootComponentInitialProps.window.scale` to your coordinates.
|
|
896
903
|
|
|
897
904
|
## Contributing
|
|
898
905
|
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
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
DELETED
package/lib/hybrid.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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 {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
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 {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
}
|