@datadog/mobile-react-native-code-push

中文文档
3.11.0发布于 2026/10/20Apache-2.0TypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 4055

A client-side React Native module to interact with Appcenter Codepush and Datadog

原始使用文档
文档目录3 节
  1. Setup
  2. Initialize the SDK
  3. Alternative to @datadog/mobile-react-native-code-push

React-Native Monitoring for AppCenter CodePush

Setup

This package is an integration for the react-native-code-push library. Before using it, install and setup the core mobile-react-native SDK.

To install with NPM, run:

npm install @datadog/mobile-react-native-code-push

To install with Yarn, run:

yarn add @datadog/mobile-react-native-code-push

Initialize the SDK

To initialize the Datadog React Native SDK for RUM, use DatadogCodepush.initialize instead of DdSdkReactNative.initialize:

import { DdSdkReactNativeConfiguration } from '@datadog/mobile-react-native';
import { DatadogCodepush } from '@datadog/mobile-react-native-code-push';

const config = new DdSdkReactNativeConfiguration(
    '<CLIENT_TOKEN>',
    '<ENVIRONMENT_NAME>',
    '<RUM_APPLICATION_ID>',
    true, // track user interactions (such as a tap on buttons). You can use the 'accessibilityLabel' element property to give the tap action a name, otherwise the element type is reported
    true, // track XHR resources
    true // track errors
);

await DatadogCodepush.initialize(config);

This method sets your reported version to the same value as the one the datadog-ci react-native codepush command uses when uploading your CodePush bundle and source maps.

Alternative to @datadog/mobile-react-native-code-push

If you use datadog-ci react-native upload to upload your CodePush bundle and source maps with a different format for the version, you can override the reported version in the SDK configuration object by using either:

  • versionSuffix (recommended) to add a suffix to the commercial version of your app
  • version to completely override the version

版本与发布记录

@datadog/mobile-react-native-code-push 共发布 106 个版本,首次发布于 2022/09/15;过去 12 个月发布了 32 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.11.0latest2026/10/2021 天前
3.10.02026/10/091 个月前
3.9.02026/10/011 个月前
3.8.02026/09/221 个月前
3.7.02026/09/032 个月前
3.6.02026/08/172 个月前

其他发布通道:next → 2.0.0-rc.0,v2 → 2.14.9。

关于 @datadog/mobile-react-native-code-push 的常见问题

@datadog/mobile-react-native-code-push 是什么?

A client-side React Native module to interact with Appcenter Codepush and Datadog

如何安装 @datadog/mobile-react-native-code-push?

在项目目录运行 npm install @datadog/mobile-react-native-code-push,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=16.13.1)、react-native(>=0.63.4 <1.0)、react-native-code-push(>=2.0.0)、@datadog/mobile-react-native(^3.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@datadog/mobile-react-native-code-push 支持 TypeScript 吗?

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

@datadog/mobile-react-native-code-push 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@datadog/mobile-react-native-code-push 可以商用吗?

@datadog/mobile-react-native-code-push 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@datadog/mobile-react-native-code-push 的下载量有多少?

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

@datadog/mobile-react-native-code-push 还在维护吗?

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