@iternio/react-native-auto-play 0.6.0 → 0.7.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 +59 -10
- package/android/src/automotive/AndroidManifest-nonnav.xml +0 -2
- package/android/src/automotive/AndroidManifest.xml +0 -2
- package/android/src/main/AndroidManifest-nonnav.xml +0 -2
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/AndroidAutoService.kt +3 -27
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlayTiming.kt +122 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/Parser.kt +49 -14
- package/installTimers.ts +3 -0
- package/installTimers.web.ts +2 -0
- package/ios/hybrid/HybridAutoPlayTiming.swift +123 -0
- package/jest.js +2 -0
- package/lib/components/SafeAreaView.js +1 -1
- package/lib/hybrid/HybridAutoPlayTiming.d.ts +2 -0
- package/lib/hybrid/HybridAutoPlayTiming.js +2 -0
- package/lib/hybrid/HybridVoice.js +2 -2
- package/lib/index.js +0 -2
- package/lib/index.web.d.ts +75 -0
- package/lib/index.web.js +72 -1
- package/lib/installTimers.d.ts +1 -0
- package/lib/installTimers.js +8 -0
- package/lib/installTimers.web.d.ts +1 -0
- package/lib/installTimers.web.js +2 -0
- package/lib/scenes/CarPlayDashboardScene.d.ts +3 -3
- package/lib/specs/AutoPlayTiming.nitro.d.ts +27 -0
- package/lib/specs/AutoPlayTiming.nitro.js +1 -0
- package/lib/types/Image.d.ts +6 -1
- package/lib/types/Telemetry.d.ts +1 -1
- package/lib/utils/AutoPlayTimers.d.ts +21 -0
- package/lib/utils/AutoPlayTimers.js +45 -0
- package/lib/utils/NitroColor.d.ts +1 -0
- package/lib/utils/NitroColor.js +8 -0
- package/lib/utils/NitroImage.d.ts +5 -2
- package/lib/utils/NitroImage.js +2 -2
- package/lib/utils/NitroManeuver.js +1 -3
- package/lib-cjs/Constants.js +9 -0
- package/lib-cjs/components/MapTemplateContext.js +10 -0
- package/lib-cjs/components/SafeAreaInsetsContext.js +21 -0
- package/lib-cjs/components/SafeAreaView.js +22 -0
- package/lib-cjs/components/WindowInformationWrapper.js +20 -0
- package/lib-cjs/hooks/useAndroidAutoTelemetry.js +115 -0
- package/lib-cjs/hooks/useFocusedEffect.js +35 -0
- package/lib-cjs/hooks/useMapTemplate.js +13 -0
- package/lib-cjs/hooks/useSafeAreaInsets.js +9 -0
- package/lib-cjs/hooks/useVoiceInput.js +42 -0
- package/lib-cjs/hybrid/HybridAndroidAutoTelemetry.js +4 -0
- package/lib-cjs/hybrid/HybridAndroidWindowInformation.js +4 -0
- package/lib-cjs/hybrid/HybridAutoPlay.js +5 -0
- package/lib-cjs/hybrid/HybridVoice.js +61 -0
- package/lib-cjs/index.js +71 -0
- package/lib-cjs/index.web.js +98 -0
- package/lib-cjs/scenes/AutoPlayCluster.js +140 -0
- package/lib-cjs/scenes/CarPlayDashboardScene.js +100 -0
- package/lib-cjs/specs/AndroidAutoTelemetry.nitro.js +2 -0
- package/lib-cjs/specs/AndroidAutomotive.nitro.js +16 -0
- package/lib-cjs/specs/AndroidWindowInformation.nitro.js +2 -0
- package/lib-cjs/specs/AutoPlay.nitro.js +2 -0
- package/lib-cjs/specs/CarPlayDashboard.nitro.js +2 -0
- package/lib-cjs/specs/Cluster.nitro.js +2 -0
- package/lib-cjs/specs/GridTemplate.nitro.js +2 -0
- package/lib-cjs/specs/InformationTemplate.nitro.js +2 -0
- package/lib-cjs/specs/ListTemplate.nitro.js +2 -0
- package/lib-cjs/specs/MapTemplate.nitro.js +2 -0
- package/lib-cjs/specs/MessageTemplate.nitro.js +2 -0
- package/lib-cjs/specs/SearchTemplate.nitro.js +2 -0
- package/lib-cjs/specs/SignInTemplate.nitro.js +2 -0
- package/lib-cjs/specs/Voice.nitro.js +2 -0
- package/lib-cjs/templates/GridTemplate.js +41 -0
- package/lib-cjs/templates/InformationTemplate.js +49 -0
- package/lib-cjs/templates/ListTemplate.js +33 -0
- package/lib-cjs/templates/MapTemplate.js +168 -0
- package/lib-cjs/templates/MessageTemplate.js +50 -0
- package/lib-cjs/templates/SearchTemplate.js +32 -0
- package/lib-cjs/templates/SignInTemplate.js +55 -0
- package/lib-cjs/templates/Template.js +40 -0
- package/lib-cjs/types/Button.js +12 -0
- package/lib-cjs/types/Event.js +2 -0
- package/lib-cjs/types/Image.js +2 -0
- package/lib-cjs/types/Maneuver.js +77 -0
- package/lib-cjs/types/RootComponent.js +2 -0
- package/lib-cjs/types/SignInMethod.js +22 -0
- package/lib-cjs/types/Telemetry.js +24 -0
- package/lib-cjs/types/Text.js +8 -0
- package/lib-cjs/types/Trip.js +2 -0
- package/lib-cjs/types/Voice.js +2 -0
- package/lib-cjs/utils/ErrorUtil.js +34 -0
- package/lib-cjs/utils/NitroAction.js +129 -0
- package/lib-cjs/utils/NitroAlert.js +19 -0
- package/lib-cjs/utils/NitroAttributedString.js +14 -0
- package/lib-cjs/utils/NitroColor.js +32 -0
- package/lib-cjs/utils/NitroGrid.js +12 -0
- package/lib-cjs/utils/NitroImage.js +97 -0
- package/lib-cjs/utils/NitroManeuver.js +79 -0
- package/lib-cjs/utils/NitroMapButton.js +33 -0
- package/lib-cjs/utils/NitroOptionsPanel.js +66 -0
- package/lib-cjs/utils/NitroSection.js +112 -0
- package/nitro.json +10 -0
- package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +2 -0
- package/nitrogen/generated/android/ReactNativeAutoPlayOnLoad.cpp +16 -0
- package/nitrogen/generated/android/c++/JActiveCarUxRestrictions.hpp +1 -1
- package/nitrogen/generated/android/c++/JAlertActionStyle.hpp +1 -1
- package/nitrogen/generated/android/c++/JAlertDismissalReason.hpp +1 -1
- package/nitrogen/generated/android/c++/JAppFocusState.hpp +1 -1
- package/nitrogen/generated/android/c++/JAssetImage.hpp +18 -18
- package/nitrogen/generated/android/c++/JAutoText.hpp +1 -1
- package/nitrogen/generated/android/c++/JBooleanTelemetryItem.hpp +1 -1
- package/nitrogen/generated/android/c++/JCarUxRestrictions.hpp +1 -1
- package/nitrogen/generated/android/c++/JChargingConnector.hpp +1 -1
- package/nitrogen/generated/android/c++/JClusterEventName.hpp +1 -1
- package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
- package/nitrogen/generated/android/c++/JDistance.hpp +1 -1
- package/nitrogen/generated/android/c++/JDistanceUnits.hpp +1 -1
- package/nitrogen/generated/android/c++/JDurationWithTimeZone.hpp +1 -1
- package/nitrogen/generated/android/c++/JEventName.hpp +1 -1
- package/nitrogen/generated/android/c++/JForkType.hpp +1 -1
- package/nitrogen/generated/android/c++/JGlyphImage.hpp +1 -1
- package/nitrogen/generated/android/c++/JGoogleSignIn.hpp +1 -1
- package/nitrogen/generated/android/c++/JGoogleSignInAccount.hpp +1 -1
- package/nitrogen/generated/android/c++/JGridImageSize.hpp +1 -1
- package/nitrogen/generated/android/c++/JGridTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridAutoPlayTimingSpec.cpp +59 -0
- package/nitrogen/generated/android/c++/JHybridAutoPlayTimingSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JImageLane.hpp +1 -1
- package/nitrogen/generated/android/c++/JInformationTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JInputSignIn.hpp +1 -1
- package/nitrogen/generated/android/c++/JKeepType.hpp +1 -1
- package/nitrogen/generated/android/c++/JKeyboardType.hpp +1 -1
- package/nitrogen/generated/android/c++/JLaneGuidance.hpp +1 -1
- package/nitrogen/generated/android/c++/JListImageType.hpp +1 -1
- package/nitrogen/generated/android/c++/JListTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JLocation.hpp +1 -1
- package/nitrogen/generated/android/c++/JManeuverState.hpp +1 -1
- package/nitrogen/generated/android/c++/JManeuverType.hpp +1 -1
- package/nitrogen/generated/android/c++/JMapTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JMessageTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JNavigationAlertAction.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroAction.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroActionType.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroAlignment.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroAttributedString.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroAttributedStringImage.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroBaseMapTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroButtonStyle.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroChargerLocation.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroChargerOutlet.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroColor.hpp +9 -5
- package/nitrogen/generated/android/c++/JNitroGridButton.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroLoadingManeuver.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroMapButton.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroMapButtonType.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroMessageManeuver.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroNavigationAlert.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroOptionsPanelChargerSection.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroOptionsPanelConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroOptionsPanelGridSection.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroRoutingManeuver.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroRow.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroSection.hpp +1 -1
- package/nitrogen/generated/android/c++/JNitroSectionType.hpp +1 -1
- package/nitrogen/generated/android/c++/JNumericTelemetryItem.hpp +1 -1
- package/nitrogen/generated/android/c++/JOffRampType.hpp +1 -1
- package/nitrogen/generated/android/c++/JOnRampType.hpp +1 -1
- package/nitrogen/generated/android/c++/JPermissionRequestResult.hpp +1 -1
- package/nitrogen/generated/android/c++/JPinSignIn.hpp +1 -1
- package/nitrogen/generated/android/c++/JPoint.hpp +1 -1
- package/nitrogen/generated/android/c++/JPreferredImageLane.hpp +1 -1
- package/nitrogen/generated/android/c++/JQrSignIn.hpp +1 -1
- package/nitrogen/generated/android/c++/JRemoteImage.hpp +1 -1
- package/nitrogen/generated/android/c++/JRouteChoice.hpp +1 -1
- package/nitrogen/generated/android/c++/JSafeAreaInsets.hpp +1 -1
- package/nitrogen/generated/android/c++/JSearchTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JSignInMethods.hpp +1 -1
- package/nitrogen/generated/android/c++/JSignInTemplateConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JStringTelemetryItem.hpp +1 -1
- package/nitrogen/generated/android/c++/JTelemetry.hpp +1 -1
- package/nitrogen/generated/android/c++/JTextInputType.hpp +1 -1
- package/nitrogen/generated/android/c++/JTrafficSide.hpp +1 -1
- package/nitrogen/generated/android/c++/JTravelEstimates.hpp +1 -1
- package/nitrogen/generated/android/c++/JTripConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JTripPoint.hpp +1 -1
- package/nitrogen/generated/android/c++/JTripPreviewTextConfiguration.hpp +1 -1
- package/nitrogen/generated/android/c++/JTripSelectorCallback.hpp +1 -1
- package/nitrogen/generated/android/c++/JTripsConfig.hpp +1 -1
- package/nitrogen/generated/android/c++/JTurnType.hpp +1 -1
- package/nitrogen/generated/android/c++/JVehicleTelemetryItem.hpp +1 -1
- package/nitrogen/generated/android/c++/JVisibilityState.hpp +1 -1
- package/nitrogen/generated/android/c++/JVisibleTravelEstimate.hpp +1 -1
- package/nitrogen/generated/android/c++/JVoiceAudioEncoding.hpp +1 -1
- package/nitrogen/generated/android/c++/JVoiceInputChunk.hpp +1 -1
- package/nitrogen/generated/android/c++/JVoiceInputResult.hpp +1 -1
- package/nitrogen/generated/android/c++/JWaypointCoordinate.hpp +1 -1
- package/nitrogen/generated/android/c++/JWindowInformation.hpp +1 -1
- package/nitrogen/generated/android/c++/JZoomEvent.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/AssetImage.kt +15 -15
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_ActiveCarUxRestrictions.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_AlertDismissalReason.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_AppFocusState.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_ColorScheme.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_Point.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_Point_double.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_Point_std__optional_Point_.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_SafeAreaInsets.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_VisibilityState.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_VoiceInputChunk.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_WindowInformation.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_bool.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__optional_Location__std__optional_std__string_.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__optional_Telemetry_.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__optional_bool_.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__optional_std__string__std__optional_GoogleSignInAccount_.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__string.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__string_ColorScheme.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__string_ZoomEvent.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__string_bool.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_std__string_std__string.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAndroidAutoTelemetrySpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAndroidAutomotiveSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAndroidWindowInformationSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlaySpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlayTimingSpec.kt +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridClusterSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridGridTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridInformationTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridListTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMapTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMessageTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridSearchTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridSignInTemplateSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoiceSpec.kt +2 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroColor.kt +9 -4
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +35 -9
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +5 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.mm +8 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.swift +12 -0
- package/nitrogen/generated/ios/c++/HybridAutoPlayTimingSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAutoPlayTimingSpecSwift.hpp +88 -0
- package/nitrogen/generated/ios/swift/AssetImage.swift +13 -13
- package/nitrogen/generated/ios/swift/HybridAutoPlayTimingSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridAutoPlayTimingSpec_cxx.swift +154 -0
- package/nitrogen/generated/ios/swift/NitroColor.swift +20 -2
- package/nitrogen/generated/shared/c++/AssetImage.hpp +18 -18
- package/nitrogen/generated/shared/c++/HybridAutoPlayTimingSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridAutoPlayTimingSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/NitroColor.hpp +7 -3
- package/package.json +12 -6
- package/src/components/SafeAreaView.tsx +1 -1
- package/src/hybrid/HybridAutoPlayTiming.ts +5 -0
- package/src/hybrid/HybridVoice.ts +2 -2
- package/src/index.ts +0 -3
- package/src/index.web.ts +166 -0
- package/src/installTimers.ts +9 -0
- package/src/installTimers.web.ts +2 -0
- package/src/specs/AutoPlayTiming.nitro.ts +25 -0
- package/src/types/Image.ts +6 -1
- package/src/types/Telemetry.ts +1 -1
- package/src/utils/AutoPlayTimers.ts +60 -0
- package/src/utils/NitroColor.ts +10 -1
- package/src/utils/NitroImage.ts +14 -8
- package/src/utils/NitroManeuver.ts +1 -4
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HeadlessTaskService.kt +0 -36
- package/lib/AutoPlayHeadlessJsTask.d.ts +0 -5
- package/lib/AutoPlayHeadlessJsTask.js +0 -14
- package/src/AutoPlayHeadlessJsTask.ts +0 -22
|
@@ -7,7 +7,7 @@ export const SafeAreaView = (props) => {
|
|
|
7
7
|
return (_jsx(View, { style: [
|
|
8
8
|
style,
|
|
9
9
|
{
|
|
10
|
-
...StyleSheet.
|
|
10
|
+
...StyleSheet.absoluteFill,
|
|
11
11
|
paddingTop: safeAreaInsets.top,
|
|
12
12
|
paddingBottom: safeAreaInsets.bottom,
|
|
13
13
|
paddingRight: safeAreaInsets.right,
|
|
@@ -5,8 +5,8 @@ const _native = NitroModules.createHybridObject('Voice');
|
|
|
5
5
|
const startVoiceInput = async (options) => {
|
|
6
6
|
const { onChunk, silenceThresholdMs, maxDurationMs, listeningText, listeningImage, preferSpeechToText, language, startSound, endSound, encoding, } = options ?? {};
|
|
7
7
|
const listeningImageRepeats = listeningImage?.type === 'asset' ? listeningImage.repeats : undefined;
|
|
8
|
-
const startSoundUri = startSound != null ? Image.resolveAssetSource(startSound)
|
|
9
|
-
const endSoundUri = endSound != null ? Image.resolveAssetSource(endSound)
|
|
8
|
+
const startSoundUri = startSound != null ? Image.resolveAssetSource(startSound)?.uri : undefined;
|
|
9
|
+
const endSoundUri = endSound != null ? Image.resolveAssetSource(endSound)?.uri : undefined;
|
|
10
10
|
return await _native.startVoiceInput(silenceThresholdMs, maxDurationMs, listeningText, NitroImageUtil.convert(listeningImage), listeningImageRepeats, preferSpeechToText, onChunk, language, startSoundUri, endSoundUri, encoding);
|
|
11
11
|
};
|
|
12
12
|
export const HybridVoice = {
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { NitroModules } from 'react-native-nitro-modules';
|
|
3
|
-
import AutoPlayHeadlessJsTask from './AutoPlayHeadlessJsTask';
|
|
4
3
|
import { HybridAndroidAutoTelemetry } from './hybrid/HybridAndroidAutoTelemetry';
|
|
5
4
|
import { HybridAndroidWindowInformation } from './hybrid/HybridAndroidWindowInformation';
|
|
6
5
|
import { HybridAutoPlay } from './hybrid/HybridAutoPlay';
|
|
7
6
|
import { HybridVoice } from './hybrid/HybridVoice';
|
|
8
|
-
AutoPlayHeadlessJsTask.registerHeadlessTask(HybridAutoPlay);
|
|
9
7
|
export { HybridAndroidAutoTelemetry, HybridAndroidWindowInformation, HybridAutoPlay, HybridVoice };
|
|
10
8
|
export const HybridAndroidAutomotive = Platform.OS === 'android'
|
|
11
9
|
? NitroModules.createHybridObject('AndroidAutomotive')
|
package/lib/index.web.d.ts
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
|
+
import type { AndroidAutomotive } from './specs/AndroidAutomotive.nitro';
|
|
3
|
+
import type { AutoPlay } from './specs/AutoPlay.nitro';
|
|
4
|
+
import type { Voice } from './specs/Voice.nitro';
|
|
5
|
+
import type { GridTemplate as RealGridTemplate } from './templates/GridTemplate';
|
|
6
|
+
import type { InformationTemplate as RealInformationTemplate } from './templates/InformationTemplate';
|
|
7
|
+
import type { ListTemplate as RealListTemplate } from './templates/ListTemplate';
|
|
8
|
+
import type { MapTemplate as RealMapTemplate } from './templates/MapTemplate';
|
|
9
|
+
import type { MessageTemplate as RealMessageTemplate } from './templates/MessageTemplate';
|
|
10
|
+
import type { SearchTemplate as RealSearchTemplate } from './templates/SearchTemplate';
|
|
11
|
+
import type { SignInTemplate as RealSignInTemplate } from './templates/SignInTemplate';
|
|
12
|
+
import type { Template as RealTemplate } from './templates/Template';
|
|
13
|
+
import type { SafeAreaInsets } from './types/Event';
|
|
14
|
+
import type { Telemetry } from './types/Telemetry';
|
|
15
|
+
export * from './Constants';
|
|
16
|
+
export * from './hooks/useMapTemplate';
|
|
17
|
+
export type { ActiveCarUxRestrictions, AppFocusState, } from './specs/AndroidAutomotive.nitro';
|
|
18
|
+
export { CarUxRestrictions } from './specs/AndroidAutomotive.nitro';
|
|
19
|
+
export type { GridImageSize, GridTemplateConfig } from './templates/GridTemplate';
|
|
20
|
+
export type { InformationItems, InformationTemplateConfig } from './templates/InformationTemplate';
|
|
21
|
+
export type { DefaultRow, ListImageType, ListTemplateConfig, MultiSection, RadioRow, Section, SingleSection, TextRow, ToggleRow, WaypointCoordinate, WaypointRow, } from './templates/ListTemplate';
|
|
22
|
+
export type { BaseMapTemplateConfig, ChargerLocation, ChargerOutlet, ChargingConnector, HeaderActionsAndroidMap, MapButtons, MapHeaderActions, MapTemplateConfig, OptionsPanelChargerSection, OptionsPanelConfig, OptionsPanelGridSection, OptionsPanelListSection, OptionsPanelSection, PanelActionsIos, PanelHeaderActions, Point, TripSelectorCallback, VisibleTravelEstimate, } from './templates/MapTemplate';
|
|
23
|
+
export type { MessageTemplateConfig } from './templates/MessageTemplate';
|
|
24
|
+
export type { SearchSection, SearchTemplateConfig } from './templates/SearchTemplate';
|
|
25
|
+
export type { SignInTemplateConfig } from './templates/SignInTemplate';
|
|
26
|
+
export type { ActionButton, HeaderActions, HeaderActionsAndroid, HeaderActionsIos, NitroBaseMapTemplateConfig, NitroTemplateConfig, TemplateConfig, } from './templates/Template';
|
|
27
|
+
export * from './types/Button';
|
|
28
|
+
export * from './types/Event';
|
|
29
|
+
export * from './types/Image';
|
|
30
|
+
export * from './types/Maneuver';
|
|
31
|
+
export * from './types/RootComponent';
|
|
32
|
+
export * from './types/SignInMethod';
|
|
33
|
+
export * from './types/Telemetry';
|
|
34
|
+
export * from './types/Text';
|
|
35
|
+
export * from './types/Trip';
|
|
36
|
+
export type { VoiceInputChunk, VoiceInputOptions, VoiceInputResult } from './types/Voice';
|
|
37
|
+
export * from './utils/ErrorUtil';
|
|
38
|
+
export type { AlertPriority, NavigationAlert as Alert, NavigationAlertAction as AlertAction, } from './utils/NitroAlert';
|
|
39
|
+
export type { ThemedColor } from './utils/NitroColor';
|
|
40
|
+
export type { GridButton } from './utils/NitroGrid';
|
|
41
|
+
export declare enum AutoPlayModules {
|
|
42
|
+
App = "main",
|
|
43
|
+
AutoPlayRoot = "AutoPlayRoot",
|
|
44
|
+
CarPlayDashboard = "CarPlayDashboard"
|
|
45
|
+
}
|
|
46
|
+
export declare const useSafeAreaInsets: () => SafeAreaInsets;
|
|
47
|
+
export declare const SafeAreaView: (props: ViewProps) => import("react").FunctionComponentElement<Omit<ViewProps, "ref"> & {
|
|
48
|
+
ref?: import("react").Ref<import("react-native").ViewInstance> | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
export declare function setIconFont(_name: string, _glyphMap?: Record<string, number>): void;
|
|
51
|
+
export declare const useFocusedEffect: () => void;
|
|
52
|
+
export declare const useVoiceInput: () => {
|
|
53
|
+
voiceInputResult: undefined;
|
|
54
|
+
resetVoiceInputResult: () => void;
|
|
55
|
+
};
|
|
56
|
+
export declare const useAndroidAutoTelemetry: () => {
|
|
57
|
+
permissionsGranted: boolean | null;
|
|
58
|
+
telemetry: Telemetry | undefined;
|
|
59
|
+
error: string | undefined;
|
|
60
|
+
};
|
|
61
|
+
export declare const AutoPlayCluster: Record<string, unknown>;
|
|
62
|
+
export declare const CarPlayDashboard: Record<string, unknown>;
|
|
63
|
+
export declare const HybridAndroidAutomotive: AndroidAutomotive | null;
|
|
64
|
+
export { HybridAndroidAutoTelemetry } from './hybrid/HybridAndroidAutoTelemetry';
|
|
65
|
+
export { HybridAndroidWindowInformation } from './hybrid/HybridAndroidWindowInformation';
|
|
66
|
+
export declare const HybridAutoPlay: AutoPlay;
|
|
67
|
+
export declare const HybridVoice: Voice;
|
|
68
|
+
export declare const Template: new (...args: never[]) => RealTemplate<unknown, unknown>;
|
|
69
|
+
export declare const ListTemplate: new (...args: never[]) => RealListTemplate;
|
|
70
|
+
export declare const GridTemplate: new (...args: never[]) => RealGridTemplate;
|
|
71
|
+
export declare const InformationTemplate: new (...args: never[]) => RealInformationTemplate;
|
|
72
|
+
export declare const MessageTemplate: new (...args: never[]) => RealMessageTemplate;
|
|
73
|
+
export declare const MapTemplate: new (...args: never[]) => RealMapTemplate;
|
|
74
|
+
export declare const SearchTemplate: new (...args: never[]) => RealSearchTemplate;
|
|
75
|
+
export declare const SignInTemplate: new (...args: never[]) => RealSignInTemplate;
|
package/lib/index.web.js
CHANGED
|
@@ -1 +1,72 @@
|
|
|
1
|
-
|
|
1
|
+
// Web/Jest stub for the native CarPlay/Android Auto surface. Nothing here talks to a real native
|
|
2
|
+
// module — every function call resolves to `undefined` (or an already-resolved promise, which is
|
|
3
|
+
// indistinguishable from `undefined` to an `await`er) rather than throwing. Types are preserved by
|
|
4
|
+
// casting against the real exports, so callers still get full type-checking/autocomplete.
|
|
5
|
+
//
|
|
6
|
+
// Anything below that's already safe as-is (pure types, plain enums, or modules that neither
|
|
7
|
+
// create native objects nor import anything that does) is re-exported directly instead of stubbed.
|
|
8
|
+
import { createElement } from 'react';
|
|
9
|
+
import { View } from 'react-native';
|
|
10
|
+
function noop() {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
/** Any property access returns a no-op function, so any method call is safe regardless of name. */
|
|
14
|
+
function createNoopObject() {
|
|
15
|
+
return new Proxy({}, {
|
|
16
|
+
get: (_target, prop) => (prop === 'then' || prop === 'toJSON' ? undefined : noop),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function createNoopClass() {
|
|
20
|
+
function NoopInstance() {
|
|
21
|
+
return createNoopObject();
|
|
22
|
+
}
|
|
23
|
+
return NoopInstance;
|
|
24
|
+
}
|
|
25
|
+
export * from './Constants';
|
|
26
|
+
export * from './hooks/useMapTemplate';
|
|
27
|
+
export { CarUxRestrictions } from './specs/AndroidAutomotive.nitro';
|
|
28
|
+
export * from './types/Button';
|
|
29
|
+
export * from './types/Event';
|
|
30
|
+
export * from './types/Image';
|
|
31
|
+
export * from './types/Maneuver';
|
|
32
|
+
export * from './types/RootComponent';
|
|
33
|
+
export * from './types/SignInMethod';
|
|
34
|
+
export * from './types/Telemetry';
|
|
35
|
+
export * from './types/Text';
|
|
36
|
+
export * from './types/Trip';
|
|
37
|
+
export * from './utils/ErrorUtil';
|
|
38
|
+
export var AutoPlayModules;
|
|
39
|
+
(function (AutoPlayModules) {
|
|
40
|
+
AutoPlayModules["App"] = "main";
|
|
41
|
+
AutoPlayModules["AutoPlayRoot"] = "AutoPlayRoot";
|
|
42
|
+
AutoPlayModules["CarPlayDashboard"] = "CarPlayDashboard";
|
|
43
|
+
})(AutoPlayModules || (AutoPlayModules = {}));
|
|
44
|
+
const NO_INSETS = { top: 0, bottom: 0, left: 0, right: 0 };
|
|
45
|
+
export const useSafeAreaInsets = () => NO_INSETS;
|
|
46
|
+
export const SafeAreaView = (props) => createElement(View, props);
|
|
47
|
+
export function setIconFont(_name, _glyphMap) { }
|
|
48
|
+
export const useFocusedEffect = () => { };
|
|
49
|
+
export const useVoiceInput = () => ({
|
|
50
|
+
voiceInputResult: undefined,
|
|
51
|
+
resetVoiceInputResult: () => { },
|
|
52
|
+
});
|
|
53
|
+
export const useAndroidAutoTelemetry = () => ({
|
|
54
|
+
permissionsGranted: null,
|
|
55
|
+
telemetry: undefined,
|
|
56
|
+
error: undefined,
|
|
57
|
+
});
|
|
58
|
+
export const AutoPlayCluster = createNoopObject();
|
|
59
|
+
export const CarPlayDashboard = createNoopObject();
|
|
60
|
+
export const HybridAndroidAutomotive = null;
|
|
61
|
+
export { HybridAndroidAutoTelemetry } from './hybrid/HybridAndroidAutoTelemetry';
|
|
62
|
+
export { HybridAndroidWindowInformation } from './hybrid/HybridAndroidWindowInformation';
|
|
63
|
+
export const HybridAutoPlay = createNoopObject();
|
|
64
|
+
export const HybridVoice = createNoopObject();
|
|
65
|
+
export const Template = createNoopClass();
|
|
66
|
+
export const ListTemplate = createNoopClass();
|
|
67
|
+
export const GridTemplate = createNoopClass();
|
|
68
|
+
export const InformationTemplate = createNoopClass();
|
|
69
|
+
export const MessageTemplate = createNoopClass();
|
|
70
|
+
export const MapTemplate = createNoopClass();
|
|
71
|
+
export const SearchTemplate = createNoopClass();
|
|
72
|
+
export const SignInTemplate = createNoopClass();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Side-effect-only entry point, re-exported at the package root as `installTimers` (see
|
|
2
|
+
// ../installTimers.ts) for `import '@iternio/react-native-auto-play/installTimers';` as the
|
|
3
|
+
// app's first import. installAutoPlayTimers() itself isn't part of the public API -- funneling
|
|
4
|
+
// installation through this one module is what actually guarantees "runs before anything else
|
|
5
|
+
// captures the original globals" (see the README) instead of just documenting it as a rule
|
|
6
|
+
// callers have to get right.
|
|
7
|
+
import { installAutoPlayTimers } from './utils/AutoPlayTimers';
|
|
8
|
+
installAutoPlayTimers();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -28,9 +28,9 @@ declare class Dashboard {
|
|
|
28
28
|
* @param eventType generic events
|
|
29
29
|
* @returns callback to remove the listener
|
|
30
30
|
*/
|
|
31
|
-
addListener(event: EventName, callback: () => void): import("
|
|
32
|
-
addListenerRenderState(callback: (payload: VisibilityState) => void): import("
|
|
33
|
-
addListenerColorScheme(callback: (payload: ColorScheme) => void): import("
|
|
31
|
+
addListener(event: EventName, callback: () => void): import("..").CleanupCallback;
|
|
32
|
+
addListenerRenderState(callback: (payload: VisibilityState) => void): import("..").CleanupCallback;
|
|
33
|
+
addListenerColorScheme(callback: (payload: ColorScheme) => void): import("..").CleanupCallback;
|
|
34
34
|
}
|
|
35
35
|
export declare const CarPlayDashboard: Dashboard;
|
|
36
36
|
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
/**
|
|
3
|
+
* Backs setTimeout/setInterval with a scheduler that never pauses -- unlike RN's own JS
|
|
4
|
+
* timers, which RN throttles or pauses whenever the app backgrounds, regardless of whether
|
|
5
|
+
* the process is actually still running.
|
|
6
|
+
*
|
|
7
|
+
* iOS: CarPlay keeps this app's process alive and driving the external screen even when the
|
|
8
|
+
* phone's own screen is off, but RN's own RCTTiming still pauses in that state regardless.
|
|
9
|
+
*
|
|
10
|
+
* Android: JavaTimerManager only keeps ticking while the host is resumed *or* a headless JS
|
|
11
|
+
* task is running -- previously satisfied by registering a permanent no-op headless task
|
|
12
|
+
* (see AutoPlayHeadlessJsTask), which this replaces.
|
|
13
|
+
*
|
|
14
|
+
* All due-time bookkeeping lives here natively (mirroring RCTTiming's/JavaTimerManager's own
|
|
15
|
+
* architecture) so JS only crosses the bridge when a timer actually fires, not on every tick.
|
|
16
|
+
*/
|
|
17
|
+
export interface AutoPlayTiming extends HybridObject<{
|
|
18
|
+
ios: 'swift';
|
|
19
|
+
android: 'kotlin';
|
|
20
|
+
}> {
|
|
21
|
+
/**
|
|
22
|
+
* Schedules `callback` to run after `durationMs`, repeating every `durationMs` if `repeats`
|
|
23
|
+
* is true. Returns an id to pass to `deleteTimer`.
|
|
24
|
+
*/
|
|
25
|
+
createTimer(callback: () => void, durationMs: number, repeats: boolean): number;
|
|
26
|
+
deleteTimer(id: number): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/types/Image.d.ts
CHANGED
|
@@ -19,7 +19,8 @@ export type GlyphMapKey = keyof AutoPlayGlyphMap extends never ? string : Extrac
|
|
|
19
19
|
type GlyphStyleFields = {
|
|
20
20
|
/**
|
|
21
21
|
* Sets the icon dark and light mode color or a single color for both.
|
|
22
|
-
* Defaults to white for dark mode and black for light mode
|
|
22
|
+
* Defaults to `'default'` if not specified, which is white for dark mode and black for light mode.
|
|
23
|
+
* On Android Auto the host tint that follows the template is not applied when `backgroundColor` is not transparent.
|
|
23
24
|
* Might not get applied everywhere like MapTemplate buttons on Android.
|
|
24
25
|
*/
|
|
25
26
|
color?: ThemedColor | string;
|
|
@@ -49,6 +50,8 @@ export type AutoImage = AutoGlyph | {
|
|
|
49
50
|
/**
|
|
50
51
|
* if specified the image gets tinted, if not it will just use the original image
|
|
51
52
|
* Might not get applied everywhere like MapTemplate buttons on Android.
|
|
53
|
+
* Use `'default'` for monochrome icons that must stay readable on both dark and light
|
|
54
|
+
* Android Auto templates (17.8+), see README.
|
|
52
55
|
*/
|
|
53
56
|
color?: ThemedColor | string;
|
|
54
57
|
type: 'asset';
|
|
@@ -57,6 +60,8 @@ export type AutoImage = AutoGlyph | {
|
|
|
57
60
|
uri: string;
|
|
58
61
|
/**
|
|
59
62
|
* if specified the image gets tinted, if not it will just use the original image
|
|
63
|
+
* Use `'default'` for monochrome icons that must stay readable on both dark and light
|
|
64
|
+
* Android Auto templates (17.8+), see README.
|
|
60
65
|
*/
|
|
61
66
|
color?: ThemedColor | string;
|
|
62
67
|
/**
|
package/lib/types/Telemetry.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Permission } from 'react-native
|
|
1
|
+
import type { Permission } from 'react-native';
|
|
2
2
|
export type AndroidAutoPermissions = Permission | AndroidAutoTelemetryPermissions | AndroidAutomotiveTelemetryPermissions;
|
|
3
3
|
export declare enum AndroidAutoTelemetryPermissions {
|
|
4
4
|
Speed = "com.google.android.gms.permission.CAR_SPEED",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replaces the global `setTimeout`/`setInterval`/`clearTimeout`/`clearInterval` and
|
|
3
|
+
* `requestAnimationFrame`/`cancelAnimationFrame` with implementations backed by the native
|
|
4
|
+
* `AutoPlayTiming` module, so they keep running while the app is actively driving a car
|
|
5
|
+
* surface even though the phone itself is backgrounded or its screen is locked. React
|
|
6
|
+
* Native's own timers throttle or pause in that state regardless of whether the process is
|
|
7
|
+
* actually still alive, which would otherwise stall ETA updates and telemetry polling.
|
|
8
|
+
*
|
|
9
|
+
* `requestIdleCallback`/`cancelIdleCallback` are deliberately not covered: bridgeless RN
|
|
10
|
+
* backs those with a separate native module unrelated to `setTimeout`/`requestAnimationFrame`
|
|
11
|
+
* (and its own callback delivery path is an unimplemented stub on iOS), so there is nothing
|
|
12
|
+
* for this library to intercept there.
|
|
13
|
+
*
|
|
14
|
+
* All due-time bookkeeping happens natively -- this is a thin pass-through, so JS only
|
|
15
|
+
* crosses the bridge when a timer actually fires, not on some fixed interval.
|
|
16
|
+
*
|
|
17
|
+
* Call this **once**, as early as possible in your app -- ideally the first line of your
|
|
18
|
+
* entry file, before any other import -- so nothing else has already captured a reference to
|
|
19
|
+
* the original globals. Safe to call more than once; only the first call has any effect.
|
|
20
|
+
*/
|
|
21
|
+
export declare function installAutoPlayTimers(): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { HybridAutoPlayTiming } from '../hybrid/HybridAutoPlayTiming';
|
|
2
|
+
let installed = false;
|
|
3
|
+
/**
|
|
4
|
+
* Replaces the global `setTimeout`/`setInterval`/`clearTimeout`/`clearInterval` and
|
|
5
|
+
* `requestAnimationFrame`/`cancelAnimationFrame` with implementations backed by the native
|
|
6
|
+
* `AutoPlayTiming` module, so they keep running while the app is actively driving a car
|
|
7
|
+
* surface even though the phone itself is backgrounded or its screen is locked. React
|
|
8
|
+
* Native's own timers throttle or pause in that state regardless of whether the process is
|
|
9
|
+
* actually still alive, which would otherwise stall ETA updates and telemetry polling.
|
|
10
|
+
*
|
|
11
|
+
* `requestIdleCallback`/`cancelIdleCallback` are deliberately not covered: bridgeless RN
|
|
12
|
+
* backs those with a separate native module unrelated to `setTimeout`/`requestAnimationFrame`
|
|
13
|
+
* (and its own callback delivery path is an unimplemented stub on iOS), so there is nothing
|
|
14
|
+
* for this library to intercept there.
|
|
15
|
+
*
|
|
16
|
+
* All due-time bookkeeping happens natively -- this is a thin pass-through, so JS only
|
|
17
|
+
* crosses the bridge when a timer actually fires, not on some fixed interval.
|
|
18
|
+
*
|
|
19
|
+
* Call this **once**, as early as possible in your app -- ideally the first line of your
|
|
20
|
+
* entry file, before any other import -- so nothing else has already captured a reference to
|
|
21
|
+
* the original globals. Safe to call more than once; only the first call has any effect.
|
|
22
|
+
*/
|
|
23
|
+
export function installAutoPlayTimers() {
|
|
24
|
+
if (installed || HybridAutoPlayTiming == null) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
installed = true;
|
|
28
|
+
const timing = HybridAutoPlayTiming;
|
|
29
|
+
const schedule = (repeats) => (callback, delay, ...args) => timing.createTimer(() => callback(...args), delay ?? 0, repeats);
|
|
30
|
+
const clear = (id) => {
|
|
31
|
+
if (typeof id === 'number') {
|
|
32
|
+
timing.deleteTimer(id);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
globalThis.setTimeout = schedule(false);
|
|
36
|
+
globalThis.setInterval = schedule(true);
|
|
37
|
+
globalThis.clearTimeout = clear;
|
|
38
|
+
globalThis.clearInterval = clear;
|
|
39
|
+
// Mirrors bridgeless RN's own implementation: requestAnimationFrame is setTimeout(0) with
|
|
40
|
+
// a performance.now() timestamp handed to the callback, and cancelAnimationFrame deletes
|
|
41
|
+
// the same underlying timer clearTimeout would.
|
|
42
|
+
const now = () => globalThis.performance?.now() ?? Date.now();
|
|
43
|
+
globalThis.requestAnimationFrame = ((callback) => timing.createTimer(() => callback(now()), 0, false));
|
|
44
|
+
globalThis.cancelAnimationFrame = clear;
|
|
45
|
+
}
|
package/lib/utils/NitroColor.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { processColor } from 'react-native';
|
|
2
|
+
const DefaultNitroColor = {
|
|
3
|
+
darkColor: convertColor('white'),
|
|
4
|
+
lightColor: convertColor('black'),
|
|
5
|
+
isDefault: true,
|
|
6
|
+
};
|
|
2
7
|
function convertColor(color) {
|
|
3
8
|
// since we accept only string it can return a number only
|
|
4
9
|
return processColor(color);
|
|
@@ -8,6 +13,9 @@ function convert(color) {
|
|
|
8
13
|
return undefined;
|
|
9
14
|
}
|
|
10
15
|
if (typeof color === 'string') {
|
|
16
|
+
if (color === 'default') {
|
|
17
|
+
return DefaultNitroColor;
|
|
18
|
+
}
|
|
11
19
|
const convertedColor = convertColor(color);
|
|
12
20
|
return { darkColor: convertedColor, lightColor: convertedColor };
|
|
13
21
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ImageResolvedAssetSource } from 'react-native';
|
|
2
1
|
import type { AutoImage } from '../types/Image';
|
|
3
2
|
import { type NitroColor } from './NitroColor';
|
|
4
3
|
/**
|
|
@@ -22,7 +21,11 @@ import { type NitroColor } from './NitroColor';
|
|
|
22
21
|
* ```
|
|
23
22
|
*/
|
|
24
23
|
export declare function setIconFont(name: string, glyphMap?: Record<string, number>): void;
|
|
25
|
-
interface AssetImage
|
|
24
|
+
interface AssetImage {
|
|
25
|
+
uri: string;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
scale: number;
|
|
26
29
|
color?: NitroColor;
|
|
27
30
|
packager_asset: boolean;
|
|
28
31
|
}
|
package/lib/utils/NitroImage.js
CHANGED
|
@@ -59,7 +59,7 @@ function convert(image) {
|
|
|
59
59
|
return undefined;
|
|
60
60
|
}
|
|
61
61
|
if (image.type === 'glyph') {
|
|
62
|
-
const { color =
|
|
62
|
+
const { color = 'default', fontScale, backgroundColor = 'transparent' } = image;
|
|
63
63
|
return {
|
|
64
64
|
glyph: resolveGlyph(image),
|
|
65
65
|
fontName: getIconFont(),
|
|
@@ -79,7 +79,7 @@ function convert(image) {
|
|
|
79
79
|
// so the input allows all optional parameters which are returned as is even though
|
|
80
80
|
// the return type claims to not have any optional parameters...
|
|
81
81
|
// we specify some default values to not crash because of proper typing required by nitro-modules
|
|
82
|
-
const { height = 0, scale = 0, uri, width = 0, ...rest } = Image.resolveAssetSource(image.image);
|
|
82
|
+
const { height = 0, scale = 0, uri = '', width = 0, ...rest } = Image.resolveAssetSource(image.image) ?? {};
|
|
83
83
|
const assetImage = {
|
|
84
84
|
height,
|
|
85
85
|
scale,
|
|
@@ -6,9 +6,7 @@ function convertManeuverImage(image) {
|
|
|
6
6
|
return undefined;
|
|
7
7
|
}
|
|
8
8
|
if (image.type === 'glyph') {
|
|
9
|
-
const color = typeof image.color === 'string'
|
|
10
|
-
? image.color
|
|
11
|
-
: (image.color ?? { darkColor: 'white', lightColor: 'black' });
|
|
9
|
+
const color = typeof image.color === 'string' ? image.color : (image.color ?? 'default');
|
|
12
10
|
return NitroImageUtil.convert({
|
|
13
11
|
...image,
|
|
14
12
|
color: color,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Constants = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const isIos27OrGreater = react_native_1.Platform.OS === 'ios' && Math.floor(Number(react_native_1.Platform.Version)) >= 27;
|
|
6
|
+
const Constants = {
|
|
7
|
+
isIos27OrGreater,
|
|
8
|
+
};
|
|
9
|
+
exports.Constants = Constants;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MapTemplateContext = void 0;
|
|
4
|
+
exports.MapTemplateProvider = MapTemplateProvider;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
exports.MapTemplateContext = (0, react_1.createContext)(null);
|
|
8
|
+
function MapTemplateProvider({ children, mapTemplate, }) {
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(exports.MapTemplateContext.Provider, { value: mapTemplate, children: children });
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SafeAreaInsetsContext = void 0;
|
|
4
|
+
exports.SafeAreaInsetsProvider = SafeAreaInsetsProvider;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const HybridAutoPlay_1 = require("../hybrid/HybridAutoPlay");
|
|
8
|
+
const DEFAULT = { top: 0, bottom: 0, left: 0, right: 0 };
|
|
9
|
+
exports.SafeAreaInsetsContext = (0, react_1.createContext)(DEFAULT);
|
|
10
|
+
function SafeAreaInsetsProvider({ children, moduleName, }) {
|
|
11
|
+
const [insets, setInsets] = (0, react_1.useState)(DEFAULT);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
const removeSafeAreaInsetsListener = HybridAutoPlay_1.HybridAutoPlay.addSafeAreaInsetsListener(moduleName, (safeAreaInsets) => {
|
|
14
|
+
setInsets(safeAreaInsets);
|
|
15
|
+
});
|
|
16
|
+
return () => {
|
|
17
|
+
removeSafeAreaInsetsListener();
|
|
18
|
+
};
|
|
19
|
+
}, [moduleName]);
|
|
20
|
+
return (0, jsx_runtime_1.jsx)(exports.SafeAreaInsetsContext.Provider, { value: insets, children: children });
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SafeAreaView = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const useSafeAreaInsets_1 = require("../hooks/useSafeAreaInsets");
|
|
7
|
+
const SafeAreaView = (props) => {
|
|
8
|
+
const { style, ...rest } = props;
|
|
9
|
+
const safeAreaInsets = (0, useSafeAreaInsets_1.useSafeAreaInsets)();
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
11
|
+
style,
|
|
12
|
+
{
|
|
13
|
+
...react_native_1.StyleSheet.absoluteFill,
|
|
14
|
+
paddingTop: safeAreaInsets.top,
|
|
15
|
+
paddingBottom: safeAreaInsets.bottom,
|
|
16
|
+
paddingRight: safeAreaInsets.right,
|
|
17
|
+
paddingLeft: safeAreaInsets.left,
|
|
18
|
+
pointerEvents: 'box-none',
|
|
19
|
+
},
|
|
20
|
+
], ...rest }));
|
|
21
|
+
};
|
|
22
|
+
exports.SafeAreaView = SafeAreaView;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WindowInformationWrapper = WindowInformationWrapper;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const HybridAndroidWindowInformation_1 = require("../hybrid/HybridAndroidWindowInformation");
|
|
6
|
+
/**
|
|
7
|
+
* Renders a user-provided root component and keeps its `window` prop up to date when the host
|
|
8
|
+
* recreates the render surface with new dimensions (some head units run Android Auto windowed
|
|
9
|
+
* and resize it at runtime), so consumers can simply read `props.window` without registering a
|
|
10
|
+
* listener themselves.
|
|
11
|
+
* On iOS this only passes the initial props through — CarPlay windows keep their size for the
|
|
12
|
+
* lifetime of a scene, so there is nothing to subscribe to.
|
|
13
|
+
*/
|
|
14
|
+
function WindowInformationWrapper({ moduleName, component, componentProps, }) {
|
|
15
|
+
const [window, setWindow] = (0, react_1.useState)(componentProps.window);
|
|
16
|
+
(0, react_1.useEffect)(() => {
|
|
17
|
+
return HybridAndroidWindowInformation_1.HybridAndroidWindowInformation?.addWindowInformationListener(moduleName, setWindow);
|
|
18
|
+
}, [moduleName]);
|
|
19
|
+
return (0, react_1.createElement)(component, { ...componentProps, window });
|
|
20
|
+
}
|