@elevenlabs/react-native

中文文档
1.2.39发布于 2026/11/11MITES Module构建来源已验证近 30 天下载 46.5万

ElevenLabs React Native SDK for the Agents Platform

原始使用文档
文档目录6 节
  1. Installation
  2. Quick Start
  3. Example App
  4. Documentation
  5. Development
  6. Contributing

hero

ElevenAgents React Native SDK

Build multimodal agents with ElevenAgents in React Native.

This package is a React Native companion to @elevenlabs/react. It re-exports the full conversation API and automatically configures the platform for voice conversations on React Native (WebRTC polyfills and native AudioSession setup).

LOGO Discord Twitter

Installation

npm install @elevenlabs/react-native @livekit/react-native @livekit/react-native-webrtc

The LiveKit peer dependencies provide the native WebRTC modules required for voice conversations in React Native.

Note: This SDK requires Expo development builds. Expo Go is not supported due to native module requirements.

Note: This package resolves its React Native entry point via the package.json "exports" field. Metro only resolves "exports" by default starting with Metro 0.82.0, which shipped in React Native 0.79.0 (released April 8, 2025). If you're on a React Native version older than 0.79, set resolver.unstable_enablePackageExports = true in your metro.config.js so this package resolves correctly:

const { getDefaultConfig } = require("metro-config");

const config = getDefaultConfig(__dirname);
config.resolver.unstable_enablePackageExports = true;

module.exports = config;

Quick Start

import {
  ConversationProvider,
  useConversationControls,
  useConversationStatus,
} from "@elevenlabs/react-native";

function App() {
  return (
    {/* replace with your agent's ID */}
    <ConversationProvider agentId="agent_7101k5zvyjhmfg983brhmhkd98n6">
      <Conversation />
    </ConversationProvider>
  );
}

function Conversation() {
  const { startSession, endSession } = useConversationControls();
  const { status } = useConversationStatus();

  return (
    <>
      <Text>Status: {status}</Text>
      <Button
        title="Start"
        onPress={() =>
          startSession({
            onConnect: ({ conversationId }) =>
              console.log("Connected:", conversationId),
            onError: (message) => console.error("Error:", message),
          })
        }
      />
      <Button title="End" onPress={() => endSession()} />
    </>
  );
}

Example App

See the Expo example app for a complete working example.

Documentation

For the full API reference, see the React Native SDK documentation.

Development

Please refer to the README.md file in the root of this repository.

Contributing

Please create an issue first to discuss the proposed changes. Any contributions are welcome!

Remember, if merged, your code will be used as part of a MIT licensed project. By submitting a Pull Request, you are giving your consent for your code to be integrated into this library.

版本与发布记录

@elevenlabs/react-native 共发布 79 个版本,首次发布于 2025/07/25;过去 12 个月发布了 64 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.2.39latest2026/11/112 天前
1.2.382026/11/058 天前
1.2.372026/11/049 天前
1.2.362026/11/0211 天前
1.2.352026/10/2915 天前
1.2.342026/10/2717 天前

其他发布通道:next → 1.0.0-rc.1。

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

@elevenlabs/react-native 是什么?

ElevenLabs React Native SDK for the Agents Platform

如何安装 @elevenlabs/react-native?

在项目目录运行 npm install @elevenlabs/react-native,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=17.0.0)、react-native(>=0.70.0)、@livekit/react-native(^2.12.0)、@livekit/react-native-webrtc(^144.1.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@elevenlabs/react-native 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/elevenlabs__react-native 是否存在。

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

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@elevenlabs/react-native 可以商用吗?

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

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

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

@elevenlabs/react-native 还在维护吗?

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