@dub/react-native

中文文档
0.0.3发布于 2026/07/02MITTypeScriptCommonJS近 30 天下载 4146

Handle deep links and track conversions from your React Native app.

原始使用文档
文档目录7 节
  1. Dub React Native SDK (BETA)
  2. Installation
  3. Usage
  4. Initialize the Dub SDK
  5. Development
  6. Contributing
  7. License
Dub.co React Native SDK to track deep links and attribution.

Dub React Native SDK (BETA)

Track deep link conversion events in your React Native app
Learn more »

Installation · Development Contributing License


Dub is the modern link attribution platform for short links, conversion tracking, and affiliate programs.

The Dub React Native SDK is a client side library built in Typescript for React Native.

It enables open tracking for regular/deferred deep links as well as tracking lead and sale conversion events.

Learn more about the Dub React Native SDK in the official documentation.


Dub is the modern link attribution platform for short links, conversion tracking, and affiliate programs. The Dub React Native SDK is a client side library built in React Native using Typescript. It enables open tracking for deep links and deferred deep links as well as conversion tracking for sale and lead events. Learn more about the Dub React Native SDK in the official documentation.

Handle deep links and track conversions from your React Native app.

Installation

npm install @dub/react-native

Usage

Initialize the Dub SDK

Option 1: Use the DubProvider to wrap your app

import { DubProvider } from '@dub/react-native';

export default function App() {
return (
    <DubProvider publishableKey="<DUB_PUBLISHABLE_KEY>" dubDomain="<DUB_DOMAIN>">
      // Your app content...
    </DubProvider>
  )
}

Option 2: Manually initialize the Dub SDK

import dub from '@dub/react-native';

export default function App() {
  useEffect(() => {
    dub.init({
      publishableKey: '<DUB_PUBLISHABLE_KEY>',
      domain: '<DUB_DOMAIN>',
    });
  }, []);

  // Return your app...
}

Development

Run pnpm install from the project root to install package dependencies. Then, start the dev server by running pnpm dev from the project root. The React Native dev server allows for hot reload.

Contributing

License

MIT

版本与发布记录

@dub/react-native 共发布 3 个版本,首次发布于 2025/09/25;过去 12 个月发布了 2 个版本。

版本发布日期距今
0.0.3latest2026/07/024 个月前
0.0.22026/02/039 个月前
0.0.12025/09/251.1 年前

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

@dub/react-native 是什么?

Handle deep links and track conversions from your React Native app.

如何安装 @dub/react-native?

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

@dub/react-native 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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