├── apps ├── docs │ ├── public │ │ └── .empty │ ├── .gitignore │ ├── style.css │ ├── pages │ │ ├── _app.mdx │ │ └── _meta.json │ ├── next-env.d.ts │ ├── next.config.js │ ├── scripts │ │ ├── cleanup.sh │ │ └── prepare.sh │ ├── typedoc.json │ ├── tsconfig.json │ ├── theme.config.tsx │ ├── LICENSE │ └── package.json └── example │ ├── .node-version │ ├── .watchmanconfig │ ├── .bundle │ └── config │ ├── .eslintrc │ ├── app.json │ ├── babel.config.js │ ├── src │ ├── images │ │ ├── cat.jpg │ │ ├── star.png │ │ ├── go@3x.png │ │ ├── item@3x.png │ │ ├── map │ │ │ ├── map.jpg │ │ │ ├── fork.png │ │ │ ├── right@3x.png │ │ │ └── uturn@3x.png │ │ └── click@3x.png │ ├── templates │ │ ├── message.template.ts │ │ ├── pane.template.ts │ │ ├── grid.template.ts │ │ ├── search.template.ts │ │ ├── list.template.ts │ │ ├── map.template.tsx │ │ └── menu.template.ts │ ├── AndroidAuto.tsx │ ├── screens │ │ ├── POI.tsx │ │ ├── VoiceControl.tsx │ │ ├── Contact.tsx │ │ ├── ActionSheet.tsx │ │ ├── List.tsx │ │ ├── TabBar.tsx │ │ ├── NowPlaying.tsx │ │ ├── Alert.tsx │ │ ├── Search.tsx │ │ ├── Information.tsx │ │ ├── Grid.tsx │ │ └── Menu.tsx │ └── App.tsx │ ├── android │ ├── app │ │ ├── debug.keystore │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── values │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── xml │ │ │ │ │ │ └── automotive_app_desc.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ └── drawable │ │ │ │ │ │ └── rn_edit_text_material.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── rncarplayscene │ │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ │ └── MainApplication.java │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ ├── AndroidManifest.xml │ │ │ │ └── java │ │ │ │ │ └── com │ │ │ │ │ └── rncarplayscene │ │ │ │ │ └── ReactNativeFlipper.java │ │ │ └── release │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── rncarplayscene │ │ │ │ └── ReactNativeFlipper.java │ │ └── proguard-rules.pro │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ ├── build.gradle │ ├── gradle.properties │ └── gradlew.bat │ ├── ios │ ├── RNCarPlayScene │ │ ├── Images.xcassets │ │ │ ├── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── LaunchScreen.storyboard │ ├── Entitlements.plist │ ├── RNCarPlayScene.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── RNCarPlayScene-Bridging-Header.h │ ├── .xcode.env │ ├── CarScene.swift │ ├── RNCarPlaySceneTests │ │ ├── Info.plist │ │ └── RNCarPlaySceneTests.m │ ├── PhoneScene.swift │ ├── AppDelegate.swift │ ├── Podfile │ └── RNCarPlayScene.xcodeproj │ │ └── xcshareddata │ │ └── xcschemes │ │ └── RNCarPlayScene.xcscheme │ ├── Gemfile │ ├── tsconfig.json │ ├── index.js │ ├── metro.config.js │ ├── .gitignore │ ├── package.json │ └── Gemfile.lock ├── packages └── react-native-carplay │ ├── .gitignore │ ├── src │ ├── interfaces │ │ ├── TimeRemainingColor.ts │ │ ├── CarColor.ts │ │ ├── AlertAction.ts │ │ ├── PauseReason.ts │ │ ├── TextConfiguration.ts │ │ ├── VoiceControlState.ts │ │ ├── Place.ts │ │ ├── ListItemUpdate.ts │ │ ├── NavigationStep.ts │ │ ├── Action.ts │ │ ├── ListSection.ts │ │ ├── NavigationInfo.ts │ │ ├── Header.ts │ │ ├── MapButton.ts │ │ ├── GridButton.ts │ │ ├── TravelEstimates.ts │ │ ├── BarButton.ts │ │ ├── NavigationAlert.ts │ │ ├── Maneuver.ts │ │ ├── Pane.ts │ │ └── ListItem.ts │ ├── templates │ │ ├── android │ │ │ ├── PaneTemplate.ts │ │ │ ├── MessageTemplate.ts │ │ │ ├── AndroidNavigationBaseTemplate.ts │ │ │ ├── NavigationTemplate.ts │ │ │ ├── PlaceListNavigationTemplate.ts │ │ │ ├── PlaceListMapTemplate.ts │ │ │ └── RoutePreviewNavigationTemplate.ts │ │ ├── AlertTemplate.ts │ │ ├── ActionSheetTemplate.ts │ │ ├── VoiceControlTemplate.ts │ │ ├── PointOfInterestTemplate.ts │ │ ├── GridTemplate.ts │ │ ├── NowPlayingTemplate.ts │ │ ├── ContactTemplate.ts │ │ ├── InformationTemplate.ts │ │ ├── TabBarTemplate.ts │ │ └── SearchTemplate.ts │ ├── navigation │ │ ├── Trip.ts │ │ └── NavigationSession.ts │ └── index.ts │ ├── tsconfig.build.json │ ├── android │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── birkir │ │ │ │ └── carplay │ │ │ │ ├── parser │ │ │ │ ├── Ext.kt │ │ │ │ ├── Parser.kt │ │ │ │ ├── RCTPaneTemplate.kt │ │ │ │ ├── RCTGridTemplate.kt │ │ │ │ ├── RCTMessageTemplate.kt │ │ │ │ ├── TemplateParser.kt │ │ │ │ ├── RCTSearchTemplate.kt │ │ │ │ └── RCTListTemplate.kt │ │ │ │ ├── screens │ │ │ │ ├── CarScreenContext.kt │ │ │ │ └── CarScreen.kt │ │ │ │ ├── CarPlayPackage.kt │ │ │ │ ├── CarPlayService.kt │ │ │ │ └── utils │ │ │ │ └── VirtualRenderer.kt │ │ │ ├── AndroidManifest.xml │ │ │ └── AndroidManifestNew.xml │ ├── gradle.properties │ ├── gradlew.bat │ └── build.gradle │ ├── .eslintrc │ ├── ios │ ├── RNCarPlayViewController.h │ ├── RCTConvert+RNCarPlay.h │ ├── RNCPStore.h │ ├── RNCarPlay.h │ ├── RNCarPlayViewController.m │ ├── RNCPStore.m │ └── RCTConvert+RNCarPlay.m │ ├── tsconfig.json │ ├── react-native-carplay.podspec │ └── package.json ├── .gitattributes ├── .prettierignore ├── .github ├── images │ ├── tabTemplate.png │ ├── alertTemplate.png │ ├── gridTemplate.png │ ├── listTemplate.png │ ├── voiceTemplate.png │ ├── searchTemplate.png │ ├── mapTemplateRoutes.png │ ├── actionSheetTemplate.png │ ├── informationTemplate.png │ └── mapTemplateNavigation.png ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── workflows │ ├── ci-monorepo-integrity.yml │ ├── ci-gh-pages.yml │ ├── ci-packages.yml │ └── ci-codeql.yml ├── .editorconfig ├── .prettierrc ├── .yarnrc.yml ├── package.json ├── .eslintrc ├── .gitignore ├── constraints.pro ├── LICENSE.md └── monorepo.code-workspace /apps/docs/public/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /apps/example/.node-version: -------------------------------------------------------------------------------- 1 | 18 -------------------------------------------------------------------------------- /apps/example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /packages/react-native-carplay/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | node_modules/ -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | *.xcodeproj binary 3 | *.xcworkspace binary 4 | -------------------------------------------------------------------------------- /apps/example/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 -------------------------------------------------------------------------------- /apps/docs/.gitignore: -------------------------------------------------------------------------------- 1 | .next/ 2 | out/ 3 | pages/index.md 4 | pages/docs/ 5 | public/.github 6 | -------------------------------------------------------------------------------- /apps/example/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": "@react-native-community" 4 | } 5 | -------------------------------------------------------------------------------- /apps/example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RNCarPlayScene", 3 | "displayName": "RNCarPlayScene" 4 | } -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .yarn 2 | **/.next/** 3 | **/dist/** 4 | **/lib/** 5 | **/build/** 6 | **/tmp/** 7 | -------------------------------------------------------------------------------- /apps/example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/TimeRemainingColor.ts: -------------------------------------------------------------------------------- 1 | export type TimeRemainingColor = 0 | 1 | 2 | 3; 2 | -------------------------------------------------------------------------------- /.github/images/tabTemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/.github/images/tabTemplate.png -------------------------------------------------------------------------------- /apps/docs/style.css: -------------------------------------------------------------------------------- 1 | @media (min-width: 768px) { 2 | .nextra-sidebar-container { 3 | width: 18rem; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.github/images/alertTemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/.github/images/alertTemplate.png -------------------------------------------------------------------------------- /.github/images/gridTemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/.github/images/gridTemplate.png -------------------------------------------------------------------------------- /.github/images/listTemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/.github/images/listTemplate.png -------------------------------------------------------------------------------- /.github/images/voiceTemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/.github/images/voiceTemplate.png -------------------------------------------------------------------------------- /apps/example/src/images/cat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/src/images/cat.jpg -------------------------------------------------------------------------------- /apps/example/src/images/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/src/images/star.png -------------------------------------------------------------------------------- /.github/images/searchTemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/.github/images/searchTemplate.png -------------------------------------------------------------------------------- /apps/example/src/images/go@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/src/images/go@3x.png -------------------------------------------------------------------------------- /apps/example/src/images/item@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/src/images/item@3x.png -------------------------------------------------------------------------------- /apps/example/src/images/map/map.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/src/images/map/map.jpg -------------------------------------------------------------------------------- /.github/images/mapTemplateRoutes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/.github/images/mapTemplateRoutes.png -------------------------------------------------------------------------------- /apps/example/src/images/click@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/src/images/click@3x.png -------------------------------------------------------------------------------- /apps/example/src/images/map/fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/src/images/map/fork.png -------------------------------------------------------------------------------- /.github/images/actionSheetTemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/.github/images/actionSheetTemplate.png -------------------------------------------------------------------------------- /.github/images/informationTemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/.github/images/informationTemplate.png -------------------------------------------------------------------------------- /.github/images/mapTemplateNavigation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/.github/images/mapTemplateNavigation.png -------------------------------------------------------------------------------- /apps/example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/debug.keystore -------------------------------------------------------------------------------- /apps/example/src/images/map/right@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/src/images/map/right@3x.png -------------------------------------------------------------------------------- /apps/example/src/images/map/uturn@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/src/images/map/uturn@3x.png -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RNCarPlayScene 3 | 4 | -------------------------------------------------------------------------------- /apps/example/ios/RNCarPlayScene/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/CarColor.ts: -------------------------------------------------------------------------------- 1 | export type CarColor = 'blue' | 'green' | 'primary' | 'red' | 'secondary' | 'yellow' | 'default'; 2 | -------------------------------------------------------------------------------- /packages/react-native-carplay/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "composite": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /apps/docs/pages/_app.mdx: -------------------------------------------------------------------------------- 1 | import '../style.css'; 2 | 3 | export default function App({ Component, pageProps }) { 4 | return ; 5 | } 6 | -------------------------------------------------------------------------------- /apps/example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/xml/automotive_app_desc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/AlertAction.ts: -------------------------------------------------------------------------------- 1 | export interface AlertAction { 2 | id: string; 3 | title: string; 4 | style?: 'default' | 'cancel' | 'destructive'; 5 | } 6 | -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /apps/example/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby '>= 2.6.10' 5 | 6 | gem 'cocoapods', '>= 1.11.3' -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/PauseReason.ts: -------------------------------------------------------------------------------- 1 | export enum PauseReason { 2 | Arrived = 1, 3 | Loading = 2, 4 | Locating = 3, 5 | Rerouting = 4, 6 | ProceedToRoute = 5, 7 | } 8 | -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /packages/react-native-carplay/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/packages/react-native-carplay/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/birkir/react-native-carplay/HEAD/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/TextConfiguration.ts: -------------------------------------------------------------------------------- 1 | export interface TextConfiguration { 2 | startButtonTitle?: string; 3 | additionalRoutesButtonTitle?: string; 4 | overviewButtonTitle?: string; 5 | } 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "trailingComma": "all", 4 | "useTabs": false, 5 | "semi": true, 6 | "singleQuote": true, 7 | "bracketSpacing": true, 8 | "tabWidth": 2, 9 | "printWidth": 100 10 | } -------------------------------------------------------------------------------- /apps/docs/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /apps/docs/pages/_meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "index": "Introduction", 3 | "CarPlay": "Apple CarPlay", 4 | "AndroidAuto": "Android Auto", 5 | "-- API": { 6 | "type": "separator", 7 | "title": "API" 8 | }, 9 | "docs": "TypeScript API" 10 | } 11 | -------------------------------------------------------------------------------- /apps/example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/react-native/tsconfig.json", 3 | "compilerOptions": { 4 | "composite": false 5 | }, 6 | "references": [ 7 | { 8 | "path": "../../packages/react-native-carplay" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /apps/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /apps/example/src/templates/message.template.ts: -------------------------------------------------------------------------------- 1 | import { CarPlay, MessageTemplate } from 'react-native-carplay'; 2 | 3 | export const messageTemplate = new MessageTemplate({ 4 | message: 'Hello, world!', 5 | debugMessage: 'Lorem ipsum', 6 | headerAction: { type: 'back' }, 7 | }); 8 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/VoiceControlState.ts: -------------------------------------------------------------------------------- 1 | import { ImageSourcePropType } from 'react-native'; 2 | 3 | export interface VoiceControlState { 4 | identifier: string; 5 | image?: ImageSourcePropType; 6 | repeats: boolean; 7 | titleVariants: string[]; 8 | } 9 | -------------------------------------------------------------------------------- /packages/react-native-carplay/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@react-native-community", 3 | "parserOptions": { 4 | "project": "tsconfig.json" 5 | }, 6 | "ignorePatterns": ["node_modules", "lib", "ios", ".eslintrc"], 7 | "rules": { 8 | "no-void": "off" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/react-native-carplay/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /apps/example/ios/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.carplay-parking 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'RNCarPlayScene' 2 | apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | includeBuild('../../../node_modules/react-native-gradle-plugin') 5 | -------------------------------------------------------------------------------- /apps/docs/next.config.js: -------------------------------------------------------------------------------- 1 | const withNextra = require('nextra')({ 2 | theme: 'nextra-theme-docs', 3 | themeConfig: './theme.config.tsx', 4 | }) 5 | 6 | module.exports = withNextra({ 7 | output: 'export', 8 | basePath: '/react-native-carplay', 9 | images: { 10 | unoptimized: true, 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /apps/docs/scripts/cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | scriptdir="$(dirname "$0")" 4 | 5 | # Remove unused md files 6 | rm "$scriptdir/../pages/docs/Home.md" || true 7 | rm "$scriptdir/../pages/docs/Exports.md" || true 8 | rm "$scriptdir/../pages/docs/_Sidebar.md" || true 9 | rm "$scriptdir/../pages/docs/.nojekyll" || true 10 | -------------------------------------------------------------------------------- /apps/example/ios/RNCarPlayScene.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /apps/example/ios/RNCarPlayScene.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/Ext.kt: -------------------------------------------------------------------------------- 1 | package org.birkir.carplay.parser 2 | 3 | import com.facebook.react.bridge.ReadableMap 4 | 5 | fun ReadableMap.isLoading(): Boolean { 6 | return try { 7 | getBoolean("loading") 8 | } catch (e: Exception) { 9 | return false 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /apps/example/src/templates/pane.template.ts: -------------------------------------------------------------------------------- 1 | import { PaneTemplate } from 'react-native-carplay'; 2 | 3 | export const paneTemplate = new PaneTemplate({ 4 | pane: { 5 | items: [ 6 | { 7 | text: 'Pane', 8 | detailText: 'Detail Text', 9 | }, 10 | ], 11 | }, 12 | headerAction: { type: 'back' }, 13 | }); 14 | -------------------------------------------------------------------------------- /packages/react-native-carplay/ios/RNCarPlayViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RNCarPlayViewController.h 3 | // Created by Susan Thapa on 27/02/2024. 4 | // 5 | #import 6 | #import 7 | 8 | @interface RNCarPlayViewController : UIViewController 9 | - (instancetype)initWithRootView:(RCTRootView *)rootView; 10 | @end 11 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/Place.ts: -------------------------------------------------------------------------------- 1 | import { ImageSourcePropType } from 'react-native'; 2 | 3 | /** 4 | * A place to be displayed on the map. 5 | * @namespace Android 6 | */ 7 | export interface Place { 8 | latitude: number; 9 | longitude: number; 10 | // Marker icon on the map 11 | icon: ImageSourcePropType; 12 | } 13 | -------------------------------------------------------------------------------- /apps/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/ListItemUpdate.ts: -------------------------------------------------------------------------------- 1 | import { ListItem } from './ListItem'; 2 | /** 3 | * A list item update payload. 4 | */ 5 | export interface ListItemUpdate extends ListItem { 6 | /** 7 | * The section of item. 8 | */ 9 | sectionIndex: number; 10 | /** 11 | * The index of item. 12 | */ 13 | itemIndex: number; 14 | } 15 | -------------------------------------------------------------------------------- /apps/docs/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["../../packages/react-native-carplay/src/index.ts"], 3 | "tsconfig": "../../packages/react-native-carplay/tsconfig.build.json", 4 | "plugin": ["typedoc-plugin-markdown", "typedoc-github-wiki-theme"], 5 | "theme": "github-wiki", 6 | "out": "./pages/docs", 7 | "publicPath": "/docs/", 8 | "gitRevision": "master" 9 | } 10 | -------------------------------------------------------------------------------- /packages/react-native-carplay/android/src/main/java/org/birkir/carplay/screens/CarScreenContext.kt: -------------------------------------------------------------------------------- 1 | package org.birkir.carplay.screens 2 | 3 | import org.birkir.carplay.utils.EventEmitter 4 | import java.util.WeakHashMap 5 | 6 | data class CarScreenContext( 7 | val screenMarker: String, 8 | var eventEmitter: EventEmitter, 9 | var screens: WeakHashMap 10 | ) 11 | -------------------------------------------------------------------------------- /packages/react-native-carplay/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/react-native/tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "composite": true, 6 | "declaration": true, 7 | "declarationMap": true, 8 | "noEmit": false, 9 | "outDir": "lib" 10 | }, 11 | "include": ["src/**/*.ts"], 12 | "exclude": ["node_modules", "lib"] 13 | } 14 | -------------------------------------------------------------------------------- /apps/docs/scripts/prepare.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | scriptdir="$(dirname "$0")" 4 | 5 | # Copy root markdown files 6 | cp "$scriptdir/../../../README.md" "$scriptdir/../pages/index.md" 7 | cp "$scriptdir/../../../CarPlay.md" "$scriptdir/../pages/CarPlay.md" 8 | cp "$scriptdir/../../../AndroidAuto.md" "$scriptdir/../pages/AndroidAuto.md" 9 | 10 | # Copy Static files 11 | cp -R "$scriptdir/../../../.github" "$scriptdir/../public/.github" 12 | 13 | # todo, split docs to classes, interfaces etc. 14 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/NavigationStep.ts: -------------------------------------------------------------------------------- 1 | import { ImageResolvedAssetSource } from 'react-native'; 2 | 3 | export type NavigationStep = { 4 | lane: { 5 | shape: number; 6 | recommended: boolean; 7 | }; 8 | cue?: string; 9 | lanesImage: ImageResolvedAssetSource; 10 | maneuver?: { 11 | type: number; 12 | icon: ImageResolvedAssetSource; 13 | roundaboutExitAngle: number; 14 | roundaboutExitNumber: number; 15 | }; 16 | road?: string; 17 | }; 18 | -------------------------------------------------------------------------------- /apps/example/src/templates/grid.template.ts: -------------------------------------------------------------------------------- 1 | import { CarPlay, GridTemplate } from 'react-native-carplay'; 2 | 3 | export const gridTemplate = new GridTemplate({ 4 | buttons: Array.from({ length: 8 }).map((_, i) => ({ 5 | id: `BUTTON_${i}`, 6 | image: require('../images/click.png'), 7 | titleVariants: [`Item ${i}`], 8 | })), 9 | title: 'Grid Template', 10 | headerAction: { type: 'back' }, 11 | onButtonPressed() { 12 | CarPlay.bridge.toast('button pressed', 1000); 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /apps/example/src/templates/search.template.ts: -------------------------------------------------------------------------------- 1 | import { CarPlay, SearchTemplate } from 'react-native-carplay'; 2 | 3 | export const searchTemplate = new SearchTemplate({ 4 | headerAction: { type: 'back' }, 5 | async onSearch(q: string) { 6 | CarPlay.bridge.toast('Searching for ' + q, 1000); 7 | }, 8 | async onItemSelect() { 9 | CarPlay.bridge.toast('Item select ', 1000); 10 | }, 11 | onSearchButtonPressed() { 12 | CarPlay.bridge.toast('onSearchButtonPressed', 1000); 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/Action.ts: -------------------------------------------------------------------------------- 1 | import { ColorValue } from 'react-native'; 2 | 3 | export type ActionType = 'appIcon' | 'back' | 'pan' | 'custom'; 4 | 5 | export interface Action { 6 | id?: string; 7 | title?: string; 8 | icon?: string; 9 | backgroundColor?: ColorValue; 10 | visibility?: 'default' | 'persistent' | 'primary'; 11 | enabled?: boolean; 12 | type?: T; 13 | } 14 | 15 | export type HeaderAction = Action<'appIcon' | 'back'>; 16 | -------------------------------------------------------------------------------- /apps/example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /apps/example/ios/RNCarPlayScene-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "RNCarPlay.h" 2 | #import 3 | 4 | #if DEBUG 5 | #if FB_SONARKIT_ENABLED 6 | #import 7 | #import 8 | #import 9 | #import 10 | #import 11 | #import 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /apps/example/ios/.xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | # NODE_BINARY variable contains the PATH to the node executable. 6 | # 7 | # Customize the NODE_BINARY variable here. 8 | # For example, to use nvm with brew, add the following line 9 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 10 | export NODE_BINARY=$(command -v node) -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | 3 | plugins: 4 | - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs 5 | spec: "@yarnpkg/plugin-workspace-tools" 6 | - path: .yarn/plugins/@yarnpkg/plugin-constraints.cjs 7 | spec: "@yarnpkg/plugin-constraints" 8 | - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs 9 | spec: "@yarnpkg/plugin-typescript" 10 | - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs 11 | spec: "@yarnpkg/plugin-interactive-tools" 12 | 13 | yarnPath: .yarn/releases/yarn-berry.cjs 14 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/templates/android/PaneTemplate.ts: -------------------------------------------------------------------------------- 1 | import { Action, HeaderAction } from '../../interfaces/Action'; 2 | import { Template, TemplateConfig } from '../Template'; 3 | import { Pane } from '../../interfaces/Pane'; 4 | 5 | export interface PaneTemplateConfig extends TemplateConfig { 6 | pane: Pane; 7 | headerAction?: HeaderAction; 8 | actions?: Action[]; 9 | title?: string; 10 | } 11 | 12 | export class PaneTemplate extends Template { 13 | public get type(): string { 14 | return 'pane'; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/ListSection.ts: -------------------------------------------------------------------------------- 1 | import { ListItem } from './ListItem'; 2 | 3 | /** 4 | * A section of list items that appear in a list template. 5 | */ 6 | export interface ListSection { 7 | /** 8 | * The section header text. 9 | */ 10 | header?: string; 11 | /** 12 | * The section index title. 13 | * 14 | * The system displays only the first character of the section index title. 15 | */ 16 | sectionIndexTitle?: string; 17 | /** 18 | * The list of items for the section. 19 | */ 20 | items: ListItem[]; 21 | } 22 | -------------------------------------------------------------------------------- /apps/example/src/templates/list.template.ts: -------------------------------------------------------------------------------- 1 | import { CarPlay, ListTemplate } from 'react-native-carplay'; 2 | 3 | const sections = Array.from({ length: 26 }).map((_, i) => ({ 4 | header: `Header ${String.fromCharCode(97 + i).toLocaleUpperCase()}`, 5 | items: Array.from({ length: 3 }).map((_, j) => ({ 6 | text: `Item ${j + 1}`, 7 | })), 8 | sectionIndexTitle: String.fromCharCode(97 + i).toLocaleUpperCase(), 9 | })); 10 | 11 | export const listTemplate = new ListTemplate({ 12 | sections, 13 | title: 'List Template', 14 | headerAction: { type: 'back' }, 15 | }); 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "root", 3 | "private": true, 4 | "scripts": { 5 | "deps:check": "yarn dlx npm-check-updates@latest --deep --mergeConfig", 6 | "deps:update": "yarn dlx npm-check-updates@latest -u --deep --mergeConfig", 7 | "check:install": "yarn dlx @yarnpkg/doctor@3.1.4 ." 8 | }, 9 | "workspaces": { 10 | "packages": [ 11 | "packages/*", 12 | "apps/*" 13 | ] 14 | }, 15 | "engines": { 16 | "node": "^14.13.1 || >=16.0.0", 17 | "yarn": ">=1.22.0", 18 | "npm": "please-use-yarn" 19 | }, 20 | "packageManager": "yarn@3.5.0" 21 | } 22 | -------------------------------------------------------------------------------- /apps/example/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry, Platform, Text } from 'react-native'; 2 | import { App } from './src/App'; 3 | import { AndroidAuto, RealAndroidAuto, AndroidAutoModule } from './src/AndroidAuto'; 4 | 5 | if (Platform.OS === 'android') { 6 | AppRegistry.registerRunnable('AndroidAuto', AndroidAutoModule); 7 | AppRegistry.registerComponent('RNCarPlayScene', () => AndroidAuto); 8 | // AppRegistry.registerRunnable('androidAuto', AndroidAutoModule); 9 | } else { 10 | AppRegistry.registerComponent('Example', () => App); 11 | AppRegistry.registerComponent('RNCarPlayScene', () => App); 12 | } 13 | -------------------------------------------------------------------------------- /apps/docs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": false, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "incremental": true, 11 | "esModuleInterop": true, 12 | "module": "esnext", 13 | "moduleResolution": "node", 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "jsx": "preserve" 17 | }, 18 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], 19 | "exclude": ["node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /apps/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /apps/example/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | const path = require('path'); 8 | const nm = ['node', 'modules'].join('_'); 9 | 10 | module.exports = { 11 | transformer: { 12 | getTransformOptions: async () => ({ 13 | transform: { 14 | experimentalImportSupport: false, 15 | inlineRequires: true, 16 | }, 17 | }), 18 | }, 19 | watchFolders: [ 20 | path.resolve(__dirname, '../../', nm), 21 | path.resolve(__dirname, '../../packages/react-native-carplay'), 22 | ], 23 | }; 24 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/NavigationInfo.ts: -------------------------------------------------------------------------------- 1 | import { ImageResolvedAssetSource } from 'react-native'; 2 | import { NavigationStep } from './NavigationStep'; 3 | 4 | export type NavigationRoutingInfo = { 5 | type: 'routingInfo'; 6 | loading?: boolean; 7 | junctionImage?: ImageResolvedAssetSource; 8 | nextStep?: NavigationStep; 9 | distance: number; 10 | distanceUnits: number; 11 | }; 12 | 13 | export type NavigationMessageInfo = { 14 | type: 'messageInfo'; 15 | title: string; 16 | icon?: ImageResolvedAssetSource; 17 | }; 18 | 19 | export type NavigationInfo = NavigationRoutingInfo | NavigationMessageInfo; 20 | -------------------------------------------------------------------------------- /apps/example/ios/CarScene.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import CarPlay 3 | 4 | class CarSceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate { 5 | func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, 6 | didConnect interfaceController: CPInterfaceController) { 7 | RNCarPlay.connect(with: interfaceController, window: templateApplicationScene.carWindow); 8 | } 9 | 10 | func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didDisconnectInterfaceController interfaceController: CPInterfaceController) { 11 | RNCarPlay.disconnect() 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/Header.ts: -------------------------------------------------------------------------------- 1 | import { Action, HeaderAction } from './Action'; 2 | 3 | export interface Header { 4 | title: string; 5 | 6 | /** 7 | * By default, a header will not have a start action. 8 | * Requirements Only one of APP_ICON or BACK is supported as a start header Action. 9 | */ 10 | startAction?: Action<'appIcon' | 'back'>; 11 | /** 12 | * By default, a template will not have end header actions. 13 | * Requirements Up to 2 actions (which are APP_ICON, BACK or TYPE_CUSTOM with an icon) at the end of the header. 14 | */ 15 | endActions?: [HeaderAction] | [HeaderAction, HeaderAction]; 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/templates/AlertTemplate.ts: -------------------------------------------------------------------------------- 1 | import { AlertAction } from '../interfaces/AlertAction'; 2 | import { Template, TemplateConfig } from './Template'; 3 | 4 | export interface AlertTemplateConfig extends TemplateConfig { 5 | titleVariants: string[]; 6 | actions?: AlertAction[]; 7 | onActionButtonPressed?(e: { id: string; templateId: string }): void; 8 | } 9 | 10 | export class AlertTemplate extends Template { 11 | public get type(): string { 12 | return 'alert'; 13 | } 14 | 15 | get eventMap() { 16 | return { 17 | actionButtonPressed: 'onActionButtonPressed', 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/react-native-carplay/react-native-carplay.podspec: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = package['name'] 7 | s.version = package['version'] 8 | s.summary = package['description'] 9 | 10 | s.homepage = package['repository']['url'] 11 | 12 | s.license = package['license'] 13 | s.authors = package['author'] 14 | s.ios.deployment_target = '12.0' 15 | 16 | s.source = { :git => "https://github.com/birkir/react-native-carplay.git" } 17 | 18 | s.source_files = "ios/*.{h,m}" 19 | 20 | s.dependency 'React' 21 | end 22 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/templates/android/MessageTemplate.ts: -------------------------------------------------------------------------------- 1 | import { Action, HeaderAction } from '../../interfaces/Action'; 2 | import { Template, TemplateConfig } from '../Template'; 3 | import { ImageSourcePropType } from 'react-native'; 4 | 5 | export interface MessageTemplateConfig extends TemplateConfig { 6 | message?: string; 7 | loading?: boolean; 8 | headerAction?: HeaderAction; 9 | actions?: Action[]; 10 | icon?: ImageSourcePropType; 11 | title?: string; 12 | debugMessage?: string; 13 | } 14 | 15 | export class MessageTemplate extends Template { 16 | public get type(): string { 17 | return 'message'; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/Parser.kt: -------------------------------------------------------------------------------- 1 | package org.birkir.carplay.parser 2 | 3 | import androidx.car.app.CarContext 4 | import androidx.car.app.model.Pane 5 | import androidx.car.app.model.PaneTemplate 6 | import androidx.car.app.model.Template 7 | import com.facebook.react.bridge.ReadableMap 8 | import org.birkir.carplay.screens.CarScreenContext 9 | 10 | class Parser( 11 | context: CarContext, 12 | carScreenContext: CarScreenContext 13 | ) : RCTTemplate(context, carScreenContext) { 14 | override fun parse(props: ReadableMap): Template { 15 | return PaneTemplate.Builder(Pane.Builder().build()).build() 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/templates/ActionSheetTemplate.ts: -------------------------------------------------------------------------------- 1 | import { AlertAction } from '../interfaces/AlertAction'; 2 | import { Template, TemplateConfig } from './Template'; 3 | 4 | export interface ActionSheetTemplateConfig extends TemplateConfig { 5 | title: string; 6 | message?: string; 7 | actions: AlertAction[]; 8 | onActionButtonPressed?(e: { id: string; templateId: string }): void; 9 | } 10 | 11 | export class ActionSheetTemplate extends Template { 12 | public get type(): string { 13 | return 'actionsheet'; 14 | } 15 | 16 | get eventMap() { 17 | return { 18 | actionButtonPressed: 'onActionButtonPressed', 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /apps/example/src/templates/map.template.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Image, View } from 'react-native'; 3 | import { CarPlay, MapTemplate } from 'react-native-carplay'; 4 | 5 | function MapView() { 6 | return ( 7 | 8 | 12 | 13 | ); 14 | } 15 | 16 | export const mapTemplate = new MapTemplate({ 17 | pane: { 18 | items: [ 19 | { 20 | text: 'Pane', 21 | detailText: 'Detail Text', 22 | }, 23 | ], 24 | }, 25 | mapButtons: [{ type: 'back' }], 26 | component: MapView, 27 | }); 28 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint:recommended", 4 | "plugin:react/recommended", 5 | "plugin:react/jsx-runtime", 6 | "plugin:@typescript-eslint/recommended", 7 | "plugin:@typescript-eslint/recommended-requiring-type-checking", 8 | "plugin:prettier/recommended" 9 | ], 10 | "parser": "@typescript-eslint/parser", 11 | "settings": { 12 | "react": { 13 | "version": "18.x" 14 | } 15 | }, 16 | "ignorePatterns": ["node_modules", "dist", "build", ".eslintrc.js"], 17 | "plugins": ["react", "@typescript-eslint"], 18 | "rules": { 19 | "@typescript-eslint/no-unsafe-member-access": "off", 20 | "@typescript-eslint/no-unsafe-assignment": "off", 21 | "@typescript-eslint/no-unsafe-return": "off" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/react-native-carplay/android/src/main/java/org/birkir/carplay/CarPlayPackage.kt: -------------------------------------------------------------------------------- 1 | package org.birkir.carplay 2 | 3 | import com.facebook.react.ReactPackage 4 | import com.facebook.react.bridge.NativeModule 5 | import com.facebook.react.bridge.ReactApplicationContext 6 | import com.facebook.react.uimanager.ViewManager 7 | 8 | class CarPlayPackage : ReactPackage { 9 | override fun createNativeModules(reactContext: ReactApplicationContext): List { 10 | val modules: MutableList = ArrayList() 11 | modules.add(CarPlayModule(reactContext)) 12 | return modules 13 | } 14 | 15 | override fun createViewManagers(reactContext: ReactApplicationContext): List> { 16 | return emptyList() 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/react-native-carplay/src/interfaces/MapButton.ts: -------------------------------------------------------------------------------- 1 | import { ImageSourcePropType } from 'react-native'; 2 | 3 | /** 4 | * A button representing an action that a map template displays on the CarPlay screen. 5 | */ 6 | export interface MapButton { 7 | /** 8 | * Button ID 9 | */ 10 | id: string; 11 | /** 12 | * The image to display on the button. 13 | */ 14 | image?: ImageSourcePropType; 15 | /** 16 | * The image to display when focus is on the button. 17 | */ 18 | focusedImage?: ImageSourcePropType; 19 | /** 20 | * A Boolean value that enables and disables the map button. 21 | */ 22 | disabled?: boolean; 23 | /** 24 | * A Boolean value that hides and shows the map button. 25 | */ 26 | hidden?: boolean; 27 | } 28 | -------------------------------------------------------------------------------- /apps/example/src/AndroidAuto.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button, Text, View } from 'react-native'; 3 | import { CarPlay } from 'react-native-carplay'; 4 | import { menuTemplate } from './templates/menu.template'; 5 | 6 | export function AndroidAutoModule() { 7 | CarPlay.emitter.addListener('didConnect', () => { 8 | CarPlay.setRootTemplate(menuTemplate); 9 | }); 10 | CarPlay.emitter.addListener('backButtonPressed', () => { 11 | CarPlay.popTemplate(); 12 | }); 13 | return; 14 | } 15 | 16 | export function AndroidAuto() { 17 | return ( 18 | 19 | Hello Android Auto 20 |