Closed jasonsemkohoag closed 8 months ago
Ran out of characters for a post. Adding the relevant code itself:
App.tsx
import React from 'react';
....
import {
BatchSize,
DatadogProvider,
DatadogProviderConfiguration,
SdkVerbosity,
UploadFrequency,
} from '@datadog/mobile-react-native';
import { DdRumReactNavigationTracking } from '@datadog/mobile-react-navigation';
const ddConfig = new DatadogProviderConfiguration(
'...',
config.environment,
'...',
true, // track User interactions (e.g.: Tap on buttons. You can use 'accessibilityLabel' element property to give tap action the name, otherwise element type will be reported)
true, // track XHR Resources
true, // track Errors
);
// Optional: Select your Datadog website (one of "US1", "EU1", "US3", "US5", "AP1" or "GOV")
ddConfig.site = 'US1';
// Optional: Enable JavaScript long task collection
ddConfig.longTaskThresholdMs = 100;
// Optional: enable or disable native crash reports
ddConfig.nativeCrashReportEnabled = true;
// Optional: sample RUM sessions (here, 100% of session will be sent to Datadog. Default = 100%)
ddConfig.sampleRate = 100;
if (config.isDev) {
ddConfig.uploadFrequency = UploadFrequency.FREQUENT;
ddConfig.batchSize = BatchSize.SMALL;
ddConfig.verbosity = SdkVerbosity.DEBUG;
}
const App: React.FC = () => {
React.useEffect(() => {
const init = async () => {
await TrackPlayer.setupPlayer();
};
init();
}, []);
const routeNameRef = React.useRef<string | undefined>();
const content = (
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
<FFContextProvider
apiKey={config.harnessApiKey}
target={{
identifier: 'reactnativeclientsdk',
name: 'ReactNativeClientSDK',
}}
fallback={
<SafeGuard
isLoading={true}
style={{ backgroundColor: Palette.lightSand }}
/>
}
>
<BackgroundColorProvider>
<QueryClientProvider client={queryClient}>
<FirebaseProvider>
<ToastsProvider>
<ScreenOverlayProvider>
<ActionSheetProvider>
<PasscodeProvider>
<ScreenOverlayProvider>
<CurrentCallProvider>
<ActivityProvider>
<AuthProvider>
<PushNotificationsProvider>
<DatadogProvider configuration={ddConfig}>
<NavigationContainer
ref={navigationRef}
theme={theme}
onReady={() => {
DdRumReactNavigationTracking.startTrackingViews(navigationRef.current);
routeNameRef.current = navigationRef
?.current?.getCurrentRoute()?.name;
}}
onStateChange={async () => {
const previousRouteName =
routeNameRef.current;
const currentRouteName = navigationRef
?.current?.getCurrentRoute()?.name;
if (
previousRouteName !== currentRouteName &&
currentRouteName
) {
await AnalyticsService.logScreenView(
currentRouteName,
);
}
routeNameRef.current = currentRouteName;
}}
>
<RootRouter />
</NavigationContainer>
</DatadogProvider>
</PushNotificationsProvider>
</AuthProvider>
</ActivityProvider>
</CurrentCallProvider>
</ScreenOverlayProvider>
</PasscodeProvider>
</ActionSheetProvider>
</ScreenOverlayProvider>
</ToastsProvider>
</FirebaseProvider>
</QueryClientProvider>
</BackgroundColorProvider>
</FFContextProvider>
</SafeAreaProvider>
);
return (
<>{config.isDev ? <ToggleStorybook>{content}</ToggleStorybook> : content}</>
);
};
export default App;
Thank you @louiszawadzki
Describe the bug
Tried to build with both xcode 15.2 and CLI and got the same result:
npx react-native run-ios --scheme '.....' --simulator="iPhone 15 Pro"
Reproduction steps
I followed the RUM installation steps, creating a new application Copied the code to my code Run in xcode 15 Logging seems to fight with itself?
SDK logs
No response
Expected behavior
No response
Affected SDK versions
2.3.0
Latest working SDK version
I'm adding this new with the latest version
Did you confirm if the latest SDK version fixes the bug?
Yes
Integration Methods
NPM
React Native Version
0.73.4
Package.json Contents
Using xcode 15, attempt to run the project. I have the following items in package.json
iOS Setup
Podfile.lock
Android Setup
No response
Device Information
Intel mac
Other relevant information
Maybe worth nothing, the instructions are different on https://docs.datadoghq.com/real_user_monitoring/mobile_and_tv_monitoring/setup/reactnative and the RUM add new application for react native?