Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion example-new-architecture/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,22 @@ import {
PropagatorType,
} from '@datadog/mobile-react-native';
import {DatadogOpenFeatureProvider} from '@datadog/mobile-react-native-openfeature';
import {
SessionReplay,
ImagePrivacyLevel,
TextAndInputPrivacyLevel,
TouchPrivacyLevel,
} from '@datadog/mobile-react-native-session-replay';
import {
OpenFeature,
OpenFeatureProvider,
useObjectFlagDetails,
} from '@openfeature/react-sdk';
import React, {Suspense} from 'react';
import React, {Suspense, useState} from 'react';
import type {PropsWithChildren} from 'react';
import {
ActivityIndicator,
Button,
SafeAreaView,
ScrollView,
StatusBar,
Expand All @@ -40,6 +47,7 @@ import {
} from 'react-native/Libraries/NewAppScreen';
// @ts-ignore
import {APPLICATION_ID, CLIENT_TOKEN, ENVIRONMENT} from './ddCredentials';
import SvgScreen from './SvgScreen';

(async () => {
const config = new CoreConfiguration(
Expand Down Expand Up @@ -72,6 +80,16 @@ import {APPLICATION_ID, CLIENT_TOKEN, ENVIRONMENT} from './ddCredentials';
// Initialize the Datadog SDK.
await DdSdkReactNative.initialize(config);

// Enable Session Replay so the SVG test screen can be verified in the Datadog portal.
// Using MASK_NON_BUNDLED_ONLY to mirror a real customer configuration — bundled SVGs
// from assets.bin should appear; remote/network images are masked.
await SessionReplay.enable({
replaySampleRate: 100,
imagePrivacyLevel: ImagePrivacyLevel.MASK_NON_BUNDLED_ONLY,
textAndInputPrivacyLevel: TextAndInputPrivacyLevel.MASK_SENSITIVE_INPUTS,
touchPrivacyLevel: TouchPrivacyLevel.SHOW,
});

// Enable Datadog Flags feature.
await DdFlags.enable();

Expand Down Expand Up @@ -120,6 +138,10 @@ function AppWithProviders() {
}

function App(): React.JSX.Element {
// example-new-architecture has no navigation library — this app has a single screen
// (App.tsx) plus the SVG test screen, toggled via local state instead of a route.
const [showSvgScreen, setShowSvgScreen] = useState(false);

const greetingFlag = useObjectFlagDetails('rn-sdk-test-json-flag', {
greeting: 'Default greeting',
});
Expand All @@ -129,6 +151,10 @@ function App(): React.JSX.Element {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};

if (showSvgScreen) {
return <SvgScreen onBack={() => setShowSvgScreen(false)} />;
}

return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
Expand All @@ -150,6 +176,13 @@ function App(): React.JSX.Element {
details.
</Section>

<Section title="Session Replay">
<Button
title="SVG Session Replay Tests →"
onPress={() => setShowSvgScreen(true)}
/>
</Section>

<Section title="Step One">
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
screen and then come back to see your edits.
Expand Down
Loading