@formbricks/react-native
v3.3.0
Published
Formbricks React Native SDK allows you to connect your app to Formbricks, display surveys and trigger events.
Readme
Formbricks React Native SDK
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
- Install the Formbricks package inside your project using npm:
npm install @formbricks/react-native- 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
environmentIdprop is still supported as a backward-compatible alias forworkspaceId, but it is deprecated and will be removed in a future major release. New integrations should useworkspaceId.
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 passappearancein thesetup()config. - An open survey switches in place; the typed answer and current question stay.
"system"follows your app's theme (Appearance.getColorScheme(), includingAppearance.setColorScheme), not the phone's, and updates live. If your app keeps its theme only in JS, callsetAppearance("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.
