@formbricks/react-native

中文文档
3.3.1发布于 2026/11/13MITTypeScriptESM + CJS构建来源已验证近 30 天下载 2390

Formbricks React Native SDK allows you to connect your app to Formbricks, display surveys and trigger events.

原始使用文档
文档目录3 节
  1. What is Formbricks
  2. How to use this library
  3. Dark mode

Formbricks React Native SDK

npm package MIT License

Please see Formbricks Docs. Specifically, Framework Guides.

What is Formbricks

Formbricks is your go-to solution for in-product micro-surveys that will supercharge your product experience! 🚀 For more information please check out formbricks.com.

How to use this library

  1. Install the Formbricks package inside your project using npm:
npm install @formbricks/react-native
  1. Import Formbricks and initialize the widget in your main component (e.g., App.tsx or App.js):
import Formbricks, { track } from "@formbricks/react-native";

export default function App() {
  return (
    <View>
      {/* Your app code */}
      <Formbricks
        appUrl="https://app.formbricks.com"
        workspaceId="your-workspace-id"
      />
    </View>
  );
}

Replace your-workspace-id with your actual workspace ID. You can find your workspace ID in the Connections instructions in the Formbricks Configuration pages.

Note: The environmentId prop is still supported as a backward-compatible alias for workspaceId, but it is deprecated and will be removed in a future major release. New integrations should use workspaceId.

For more detailed guides for different frameworks, check out our Framework Guides.

Dark mode

Surveys render light by default. Call setAppearance to change it:

import { setAppearance } from "@formbricks/react-native";

setAppearance("dark"); // "light" | "dark" | "system"
  • Works before or after setup(), or pass appearance in the setup() config.
  • An open survey switches in place; the typed answer and current question stay.
  • "system" follows your app's theme (Appearance.getColorScheme(), including Appearance.setColorScheme), not the phone's, and updates live. If your app keeps its theme only in JS, call setAppearance("light" | "dark") yourself when it changes.
  • Kept across logout(), forgotten on app restart, never sent to the server. An unknown value logs an error and falls back to light.
  • Needs a Formbricks server that supports dark mode; an older server keeps surveys light.

Custom CSS configured in Formbricks needs no SDK call; it arrives with the workspace state.

版本与发布记录

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

版本发布日期距今
3.3.1latest2026/11/132 天前
3.3.02026/10/2026 天前
3.2.02026/09/211 个月前
3.1.02026/08/063 个月前
3.0.12026/06/294 个月前
3.0.02026/05/275 个月前

其他发布通道:beta → 2.0.0-beta.2。

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

@formbricks/react-native 是什么?

Formbricks React Native SDK allows you to connect your app to Formbricks, display surveys and trigger events.

如何安装 @formbricks/react-native?

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

@formbricks/react-native 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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