diff --git a/apps/demo-react-native/.env.example b/apps/demo-react-native/.env.example index 3a2d97bdc4..340aecb341 100644 --- a/apps/demo-react-native/.env.example +++ b/apps/demo-react-native/.env.example @@ -1,2 +1,2 @@ -EXPO_PUBLIC_API_HOST=http://192.168.178.20:3000 -EXPO_PUBLIC_FORMBRICKS_ENVIRONMENT_ID=clzr04nkd000bcdl110j0ijyq +EXPO_PUBLIC_APP_URL=http://192.168.0.197:3000 +EXPO_PUBLIC_FORMBRICKS_ENVIRONMENT_ID=cm5p0cs7r000819182b32j0a1 \ No newline at end of file diff --git a/apps/demo-react-native/app.json b/apps/demo-react-native/app.json index 66cd17cbb8..31d6cb2a53 100644 --- a/apps/demo-react-native/app.json +++ b/apps/demo-react-native/app.json @@ -18,6 +18,7 @@ }, "jsEngine": "hermes", "name": "react-native-demo", + "newArchEnabled": true, "orientation": "portrait", "slug": "react-native-demo", "splash": { diff --git a/apps/demo-react-native/package.json b/apps/demo-react-native/package.json index 4dc5955136..acd06c3451 100644 --- a/apps/demo-react-native/package.json +++ b/apps/demo-react-native/package.json @@ -13,16 +13,17 @@ "dependencies": { "@formbricks/js": "workspace:*", "@formbricks/react-native": "workspace:*", - "expo": "52.0.18", - "expo-status-bar": "2.0.0", + "@react-native-async-storage/async-storage": "2.1.0", + "expo": "52.0.28", + "expo-status-bar": "2.0.1", "react": "18.3.1", "react-dom": "18.3.1", - "react-native": "0.76.5", + "react-native": "0.76.6", "react-native-webview": "13.12.5" }, "devDependencies": { "@babel/core": "7.26.0", - "@types/react": "19.0.1", + "@types/react": "18.3.18", "typescript": "5.7.2" }, "private": true diff --git a/apps/demo-react-native/src/app.tsx b/apps/demo-react-native/src/app.tsx index 28e0f50552..a4816481e3 100644 --- a/apps/demo-react-native/src/app.tsx +++ b/apps/demo-react-native/src/app.tsx @@ -1,7 +1,14 @@ import { StatusBar } from "expo-status-bar"; import React, { type JSX } from "react"; import { Button, LogBox, StyleSheet, Text, View } from "react-native"; -import Formbricks, { track } from "@formbricks/react-native"; +import Formbricks, { + logout, + setAttribute, + setAttributes, + setLanguage, + setUserId, + track, +} from "@formbricks/react-native"; LogBox.ignoreAllLogs(); @@ -10,35 +17,92 @@ export default function App(): JSX.Element { throw new Error("EXPO_PUBLIC_FORMBRICKS_ENVIRONMENT_ID is required"); } - if (!process.env.EXPO_PUBLIC_API_HOST) { - throw new Error("EXPO_PUBLIC_API_HOST is required"); + if (!process.env.EXPO_PUBLIC_APP_URL) { + throw new Error("EXPO_PUBLIC_APP_URL is required"); } - const config = { - environmentId: process.env.EXPO_PUBLIC_FORMBRICKS_ENVIRONMENT_ID as string, - apiHost: process.env.EXPO_PUBLIC_API_HOST as string, - userId: "random-user-id", - attributes: { - language: "en", - testAttr: "attr-test", - }, - }; - return ( Formbricks React Native SDK Demo -