@g4rb4g3/react-native-carplay

中文文档
2.7.22发布于 2025/12/09MITTypeScriptCommonJS零依赖近 30 天下载 2068

CarPlay for React Native

原始使用文档
文档目录22 节
  1. Features
  2. Installation
  3. Expo SDK 53 Compatibility
  4. Requirements
  5. iOS
  6. Android
  7. Setup
  8. iOS Setup
  9. Android Setup
  10. Basic Usage
  11. Templates
  12. List Template
  13. Map Template
  14. Grid Template
  15. Now Playing Template
  16. Troubleshooting
  17. Android Build Issues
  18. Common Issues
  19. Migration from Previous Versions
  20. Contributing
  21. License
  22. Support

React Native CarPlay

CarPlay and Android Auto support for React Native applications.

Features

  • 📱 CarPlay Support: Full iOS CarPlay integration
  • 🚗 Android Auto Support: Complete Android Auto compatibility
  • 🎯 Expo SDK 53 Compatible: Updated for the latest Expo SDK
  • 🏗️ New Architecture Ready: Supports React Native's New Architecture
  • 📍 Navigation Templates: Map, List, Grid, and more
  • 🎵 Media Support: Now Playing templates and audio controls
  • 📞 Communication: Contact and messaging templates

Installation

npm install @g4rb4g3/react-native-carplay
# or
yarn add @g4rb4g3/react-native-carplay

Expo SDK 53 Compatibility

This version has been updated for full compatibility with Expo SDK 53, including:

  • ✅ Android API 34: Updated to target stable Android version
  • ✅ Kotlin 1.9.10: Stable Kotlin version with proven compatibility
  • ✅ Gradle 8.4: Updated build tools for better compatibility
  • ✅ React Native 0.76+: Support for React Native versions compatible with Expo SDK 53
  • ✅ New Architecture: Full support for Fabric and TurboModules

Requirements

iOS

  • iOS 14.0+
  • Xcode 16+
  • CarPlay capability in your app

Android

  • Android API 23+ (Android 6.0)
  • Android Auto support
  • Automotive App Library 1.7.0

Setup

iOS Setup

  1. Add CarPlay capability to your app:

    <!-- ios/YourApp/Info.plist -->
    <key>UIRequiredDeviceCapabilities</key>
    <array>
      <string>carplay</string>
    </array>
    
  2. Configure CarPlay scenes in your app delegate.

Android Setup

  1. Add Android Auto permissions to your manifest:

    <!-- android/app/src/main/AndroidManifest.xml -->
    <uses-permission android:name="androidx.car.app.NAVIGATION_TEMPLATES" />
    <uses-permission android:name="androidx.car.app.MAP_TEMPLATES" />
    <uses-permission android:name="androidx.car.app.ACCESS_SURFACE" />
    
  2. Configure your CarPlay service in the manifest.

Basic Usage

import { CarPlay } from '@g4rb4g3/react-native-carplay';

// Initialize CarPlay
CarPlay.connect();

// Create a simple list template
const listTemplate = {
  id: 'main-list',
  title: 'My App',
  sections: [{
    items: [
      { id: '1', text: 'Item 1', detailText: 'Detail 1' },
      { id: '2', text: 'Item 2', detailText: 'Detail 2' },
    ]
  }],
  onItemSelect: (item) => {
    console.log('Selected:', item);
  }
};

// Present the template
CarPlay.presentTemplate(listTemplate);

Templates

List Template

Perfect for displaying lists of items like music, contacts, or navigation destinations.

Map Template

Ideal for navigation apps with turn-by-turn directions and points of interest.

Grid Template

Great for displaying visual content like album covers or category icons.

Now Playing Template

Essential for music and audio apps to show current playback status.

Troubleshooting

Android Build Issues

If you encounter build issues after upgrading to Expo SDK 53:

  1. Clean your build cache:

    cd android && ./gradlew clean
    
  2. Update your project's Gradle version in android/gradle/wrapper/gradle-wrapper.properties:

    distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
    
  3. Ensure correct SDK versions in your android/build.gradle:

    compileSdkVersion 34
    targetSdkVersion 34
    minSdkVersion 23
    
  4. Update Kotlin version in your project's android/build.gradle:

    ext.kotlinVersion = '1.9.25'
    

Common Issues

  • "Module not found": Make sure you've run pod install (iOS) or rebuilt your project (Android)
  • CarPlay not connecting: Ensure your app has the CarPlay capability and proper entitlements
  • Android Auto not working: Check that all required permissions are added to your manifest

Migration from Previous Versions

If upgrading from an older version:

  1. Update your dependencies to match Expo SDK 53
  2. Rebuild your development build
  3. Test all CarPlay/Android Auto functionality
  4. Update any deprecated API usage

Contributing

We welcome contributions! Please read our contributing guidelines and submit pull requests to the main repository.

License

MIT License - see LICENSE file for details.

Support


Made with ❤️ for the React Native community

版本与发布记录

@g4rb4g3/react-native-carplay 共发布 131 个版本,首次发布于 2024/10/15;过去 12 个月发布了 3 个版本。

版本发布日期距今
2.7.22latest2025/12/0911 个月前
2.7.212025/12/0211 个月前
2.7.202025/12/0211 个月前
2.7.192025/10/021.1 年前
2.7.182025/09/301.1 年前
2.7.172025/09/301.1 年前

关于 @g4rb4g3/react-native-carplay 的常见问题

@g4rb4g3/react-native-carplay 是什么?

CarPlay for React Native

如何安装 @g4rb4g3/react-native-carplay?

在项目目录运行 npm install @g4rb4g3/react-native-carplay,或使用 pnpm add / yarn add / bun add。

@g4rb4g3/react-native-carplay 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@g4rb4g3/react-native-carplay 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@g4rb4g3/react-native-carplay 可以商用吗?

@g4rb4g3/react-native-carplay 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@g4rb4g3/react-native-carplay 的下载量有多少?

根据 npm 官方下载统计,@g4rb4g3/react-native-carplay 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,068 次,日均约 69 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@g4rb4g3/react-native-carplay 还在维护吗?

最新版本 2.7.22 发布于 2025/12/09(11 个月前);至今共发布 131 个版本,其中过去 12 个月发布了 3 个;首次发布于 2024/10/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。