From aefea8b502fa980f8758419f6801d622de20801d Mon Sep 17 00:00:00 2001 From: Dhruwang Date: Wed, 7 Oct 2026 17:34:14 +0530 Subject: [PATCH 1/3] feat: add setAppearance for dark mode and forward custom CSS to the survey renderer [ENG-3646] --- apps/playground/app.json | 2 +- apps/playground/src/app.tsx | 45 +++++++- packages/react-native/README.md | 18 ++++ .../src/components/survey-web-view.tsx | 38 ++++++- .../tests/survey-web-view-harness.test.ts | 17 +++ packages/react-native/src/index.ts | 18 ++++ .../react-native/src/lib/common/appearance.ts | 102 ++++++++++++++++++ packages/react-native/src/lib/common/setup.ts | 7 ++ .../src/lib/common/tests/appearance.test.ts | 100 +++++++++++++++++ .../src/lib/common/tests/utils.test.ts | 35 ++++++ packages/react-native/src/lib/common/utils.ts | 31 +++++- packages/react-native/src/types/config.ts | 6 +- packages/react-native/src/types/survey.ts | 8 +- packages/react-native/src/types/workspace.ts | 6 ++ 14 files changed, 424 insertions(+), 9 deletions(-) create mode 100644 packages/react-native/src/lib/common/appearance.ts create mode 100644 packages/react-native/src/lib/common/tests/appearance.test.ts diff --git a/apps/playground/app.json b/apps/playground/app.json index f3cdaa4..cee233a 100644 --- a/apps/playground/app.json +++ b/apps/playground/app.json @@ -21,7 +21,7 @@ "image": "./assets/splash.png", "resizeMode": "contain" }, - "userInterfaceStyle": "light", + "userInterfaceStyle": "automatic", "version": "1.0.0", "web": { "favicon": "./assets/favicon.png" diff --git a/apps/playground/src/app.tsx b/apps/playground/src/app.tsx index c96eee3..204ad66 100644 --- a/apps/playground/src/app.tsx +++ b/apps/playground/src/app.tsx @@ -1,5 +1,6 @@ import Formbricks, { logout, + setAppearance, setAttribute, setAttributes, setLanguage, @@ -8,11 +9,20 @@ import Formbricks, { } from "@formbricks/react-native"; import { StatusBar } from "expo-status-bar"; import type { JSX } from "react"; -import { Button, LogBox, StyleSheet, Text, View } from "react-native"; +import { + Appearance, + Button, + LogBox, + StyleSheet, + Text, + useColorScheme, + View, +} from "react-native"; LogBox.ignoreAllLogs(); export default function App(): JSX.Element { + const appTheme = useColorScheme(); if (!process.env.EXPO_PUBLIC_FORMBRICKS_WORKSPACE_ID) { throw new Error("EXPO_PUBLIC_FORMBRICKS_WORKSPACE_ID is required"); } @@ -22,8 +32,15 @@ export default function App(): JSX.Element { } return ( - - Formbricks React Native SDK Demo + + + Formbricks React Native SDK Demo + + +