diff --git a/examples/ExpoApp/app/(tabs)/index.tsx b/examples/ExpoApp/app/(tabs)/index.tsx
index 44e802b..a34888e 100644
--- a/examples/ExpoApp/app/(tabs)/index.tsx
+++ b/examples/ExpoApp/app/(tabs)/index.tsx
@@ -5,6 +5,7 @@ import ParallaxScrollView from '@/components/ParallaxScrollView';
import { ThemedText } from '@/components/ThemedText';
import { ThemedView } from '@/components/ThemedView';
import RobotComponent from '../RobotComponent';
+import TwoFlagsComponent from '../TwoFlagsComponent';
export default function HomeScreen() {
return (
@@ -21,6 +22,7 @@ export default function HomeScreen() {
+
Step 1: Try it
diff --git a/examples/ExpoApp/app/TwoFlagsComponent.tsx b/examples/ExpoApp/app/TwoFlagsComponent.tsx
new file mode 100644
index 0000000..22fb361
--- /dev/null
+++ b/examples/ExpoApp/app/TwoFlagsComponent.tsx
@@ -0,0 +1,72 @@
+import React, { useEffect } from 'react';
+import {Text, View} from 'react-native';
+import {useFbClient, useFlags, UserBuilder} from '@featbit/react-client-sdk';
+
+export default function TwoFlagsComponent() {
+ const flags = useFlags();
+ const flagA = flags["flag-a"];
+ const flagB = flags["flag-b"];
+ const fbClient = useFbClient();
+
+ useEffect(() => {
+ if (!fbClient) return;
+ let active = true;
+
+ const loadVarations = async (keys: string[]) => {
+ const all = await fbClient.getAllVariations();
+ console.log('loadVarations', keys);
+ if (active) {
+ console.log('active in loadVariations');
+ }
+ }
+
+ fbClient.on("update", loadVarations);
+
+ return () => {
+ active = false;
+ fbClient.off("update", loadVarations);
+ }
+ }, [fbClient])
+
+ // useEffect(() => {
+ // const variationId = `203:${flagA}:exclusive`;
+ // const user = new UserBuilder("fb-demo-user-key")
+ // .name("the user name")
+ // .custom("loggedIn", "true")
+ // .custom("variationId", variationId)
+ // .build();
+ //
+ // fbClient?.identify(user);
+ // }, [fbClient, flagA]);
+
+ return (
+
+
+ flagA: {flagA}
+
+
+ flagB: {flagB}
+
+
+ );
+}
diff --git a/examples/ExpoApp/app/_layout.tsx b/examples/ExpoApp/app/_layout.tsx
index af81a30..34438b4 100644
--- a/examples/ExpoApp/app/_layout.tsx
+++ b/examples/ExpoApp/app/_layout.tsx
@@ -6,7 +6,7 @@ import 'react-native-reanimated';
import { useColorScheme } from '@/hooks/useColorScheme';
-import {buildConfig, withFbProvider} from '@featbit/react-native-sdk';
+import {buildConfig, UserBuilder, withFbProvider} from '@featbit/react-native-sdk';
// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();
@@ -37,13 +37,15 @@ function RootLayout() {
);
}
+const user = new UserBuilder("fb-demo-user-key")
+ .name("the user name")
+ .custom("loggedIn", "true")
+ .custom("variationId", "203:b:exclusive")
+ .build();
+
const options = {
- user: {
- name: 'the user name',
- keyId: 'fb-demo-user-key',
- customizedProperties: [],
- },
- sdkKey: 'Obg68EqYZk27JTxphPgy7At1aJ8GaAtEaIA1fb3IpuEA',
+ user,
+ sdkKey: '3QFLBQibTE6i1duL1WAK2A227SK-9N8k-9VqurJDE_Qw',
streamingUri: 'wss://app-eval.featbit.co',
eventsUri: 'https://app-eval.featbit.co',
};