@warplink/react-native

中文文档
1.3.0发布于 2026/11/03MITTypeScriptESM + CJS零依赖构建来源已验证

WarpLink deep linking, install attribution, and real-time analytics SDK for React Native

原始使用文档
文档目录14 节
  1. Requirements
  2. Installation
  3. Bare React Native
  4. Expo Managed Workflow
  5. Quick Start
  6. Getting your SDK key
  7. Required native host setup
  8. Using a custom link domain
  9. Testing a first install
  10. Disabling any piece
  11. Features
  12. Documentation
  13. Links
  14. License

@warplink/react-native

License: MIT npm version CI

Deep linking, install attribution, and real-time analytics for React Native. Handle Universal Links and App Links, resolve deferred deep links, and attribute installs with WarpLink.

Requirements

RequirementMinimum Version
React Native>= 0.75.0
React>= 18.0.0
iOS15+
AndroidAPI 26+ (Android 8.0)
Node.js18+

Both React Native architectures are supported. The New Architecture is the only one from React Native 0.82 onward, and it is what a new app gets today. The Android bridge is compiled against both ends of that range on every check, and the current React Native is exercised on a device each release.

Installation

Bare React Native

npm install @warplink/react-native

The iOS SDK is distributed via Swift Package Manager and pulled in automatically by the React Native podspec. SPM integration requires dynamic frameworks, so add this to your ios/Podfile inside your app's target block:

use_frameworks! :linkage => :dynamic

Then install iOS pods:

cd ios && pod install

Android auto-links via React Native CLI. No additional setup required.

Expo Managed Workflow

npx expo install @warplink/react-native

Then generate native projects:

npx expo prebuild

Note: This SDK requires native modules and does not work with Expo Go. You must use a development build (npx expo prebuild or EAS Build).

Quick Start

The SDK is opt-out: a bare configure({ apiKey, onLink }) wires cold-start, warm-start, and deferred deep links automatically. All three flow into your one onLink callback. No useEffect, no manual subscriptions.

The deferred check retries on the next launch.

import { WarpLink } from '@warplink/react-native';

// Call once at app startup, outside any component.
WarpLink.configure({
  apiKey: 'wl_live_yoursdkkeyhere000000000000000000',
  onLink: ({ deepLink, error }) => {
    if (deepLink) {
      // Fires for cold start, warm start, AND deferred (first launch).
      // Disambiguate deferred installs with deepLink.isDeferred.
      navigate(deepLink.deepLinkUrl ?? deepLink.destination);
    } else if (error) {
      console.error('WarpLink error:', error.code, error.message);
    }
  },
}).catch((e) => console.error('WarpLink configure failed:', e));

That's the whole happy path. onLink receives every deep link the app sees.

Getting your SDK key

apiKey takes an SDK key, created under Keys > SDK keys in the dashboard. It is pre-scoped for link resolution and install attribution. API keys are a separate credential for backend scripts, CI, and AI agents, and they cannot record installs. Both share the wl_live_ prefix, so pasting an API key here is an easy mistake: deep links keep resolving, but no installs ever appear in your dashboard. See the Integration Guide for the full walkthrough.

Required native host setup

Two native hooks are required for deep links to reach the SDK. They are not optional.

  • iOS: your AppDelegate must forward incoming URLs to WarpLinkModule.handleIncomingURL(url), which delivers iOS Universal Links to the SDK. See iOS host hook. If your app declares a UIApplicationSceneManifest and has a SceneDelegate (the default for a plain Xcode template, and required by Apple for apps built with its newer SDKs, which do not launch at all without one), the same forward is also required in SceneDelegate: iOS stops calling the AppDelegate hook entirely once a scene exists. See iOS SceneDelegate hook.
  • Android: your launch Activity must declare android:launchMode="singleTask" so warm-start intents reach the SDK. See Android setup.

aplnk.to works out of the box. If your links are on your own domain, declare it so the SDK recognizes it on the very first launch, before it has fetched your domain list and even with no network:

WarpLink.configure({
  apiKey: 'wl_live_yoursdkkeyhere000000000000000000',
  linkDomains: ['links.yourapp.com'],
  onLink: handleLink,
});

The same declaration can live in Info.plist (WarpLinkDomains) or the Android manifest (app.warplink.DOMAINS) instead. All sources are merged, so declaring in more than one place is safe. See Custom link domains.

Testing a first install

A wl_test_ key keeps its attribution state apart from wl_live_ state on the same device. Use a Test key in debug builds. To test a first install again without deleting the app, call WarpLink.clearAttribution() with a Test key. It clears the attribution stored on the device and starts a new check. It does nothing with a live key.

Disabling any piece

Each source is independently disable-able. Turn one off and wire it yourself.

WarpLink.configure({
  apiKey: 'wl_live_yoursdkkeyhere000000000000000000',
  onLink: handleLink,
  automaticDeepLinks: false,          // you call onDeepLink()/getInitialDeepLink()
  automaticDeferredDeepLinks: false,  // you call checkDeferredDeepLink()
});

Omit onLink entirely to keep the manual model for deep links. Two things changed from 1.0.x: configure() no longer throws on a malformed key (it reports through onLink and a console warning instead), and AttributionResult.installId was removed. Everything else in the pre-1.1 API is unchanged and still supported. The deferred check still fires, because that request is what attributes the install; call checkDeferredDeepLink() to read the match, or pass automaticDeferredDeepLinks: false to switch the check off:

WarpLink.configure({ apiKey: 'wl_live_yoursdkkeyhere000000000000000000' });

function App() {
  useEffect(() => {
    const unsubscribe = WarpLink.onDeepLink(({ deepLink }) => {
      if (deepLink) navigate(deepLink.destination);
    });
    WarpLink.getInitialDeepLink().then((l) => l && navigate(l.destination));
    WarpLink.checkDeferredDeepLink().then((l) => l?.isDeferred && navigate(l.destination));
    return unsubscribe;
  }, []);
  return <>{/* Your app */}</>;
}

Features

  • Opt-out by default: one configure({ apiKey, onLink }) call turns on cold-start, warm-start, and deferred deep linking. Each is independently disable-able.
  • Universal Link & App Link Handling: resolve incoming deep links to destinations and custom parameters. See the Integration Guide.
  • Deferred Deep Links: route users to specific content even after App Store or Play Store install. See Deferred Deep Links.
  • Install Attribution: deterministic and probabilistic matching with confidence scores. See Attribution.
  • Cross-Platform: single TypeScript API for both iOS and Android with platform-specific native bridges.
  • No ATT Required: uses IDFV on iOS (exempt from App Tracking Transparency). No IDFA, no user prompts.
  • Debug Logging: enable with { debugLogging: true } in configure options to trace SDK behavior.
  • Native SDK version: await WarpLink.sdkVersion() returns the version the native SDK reports.
  • Attribution completion: await WarpLink.isAttributionComplete() tells you whether the deferred check has definitively finished for this install.
  • Zero Dependencies: no third-party runtime dependencies. Only peer dependencies on react and react-native.

Documentation

GuideDescription
Integration GuideStep-by-step setup from zero to working deep links
API ReferenceComplete reference for all public types and methods
Deferred Deep LinksHow deferred deep linking works and how to use it
AttributionInstall attribution tiers and confidence scores
Error HandlingEvery error case with recommended recovery actions
TroubleshootingCommon issues and solutions
Firebase MigrationMigrate from Firebase Dynamic Links to WarpLink
ArchitectureHow the SDK bridges to native iOS and Android SDKs

License

MIT License. See LICENSE for details.

版本与发布记录

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

版本发布日期距今
1.3.0latest2026/11/03今天
1.2.02026/10/268 天前
1.1.12026/10/1123 天前
1.1.02026/09/151 个月前
1.0.22026/06/274 个月前
1.0.12026/06/254 个月前

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

@warplink/react-native 是什么?

WarpLink深度链接,为React Native安装归因和实时分析SDK

如何安装 @warplink/react-native?

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

@warplink/react-native 支持 TypeScript 吗?

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

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

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

@warplink/react-native 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

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

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

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

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