Skip to main content
This page covers the advanced options of the React Native SDK. All options are set as properties on a DdSdkReactNativeConfiguration instance before calling DdSdkReactNative.initialize(config).

Sampling

TrackingConsent controls whether data is collected and reported, for compliance requirements such as GDPR:

Event filtering and scrubbing

Event mappers run before an event is reported. Return null to drop the event, or return a modified event. Use them to scrub sensitive fields or remove noise.

Distributed tracing

For hosts matched by firstPartyHosts (including subdomains), the SDK injects trace headers into XHR / fetch requests so that frontend RUM and backend APM traces are correlated. By default both the W3C traceparent and Datadog-format headers are injected; you can choose propagatorTypes per host.

Custom intake endpoints

For on-premises deployments, override the RUM and Logs intake endpoints separately through customEndpoints:
Each value is the final intake URL, not a base address containing only the scheme and host. rum must include /api/v2/rum; if the deployment sits under a path prefix, keep that prefix as well, for example https://example.com/flashduty/api/v2/rum. The public cloud needs no setting; keep config.site = 'CN'.

WebView tracking

If your application embeds WebViews, replace react-native-webview with the WebView exported by @flashcatcloud/mobile-react-native-webview to associate the Browser RUM events inside the WebView with the current native RUM session.
allowedHosts is the list of hosts allowed to be associated; subdomains are matched. The page loaded in the WebView must already integrate the Flashduty Browser SDK. The component is fully compatible with the props of react-native-webview.

Source map upload

JS stack traces from release builds are minified; upload source maps so the console can resolve them to source files and line numbers. The server matches source maps by service + version + bundle file name, so the service and version used at upload time must match what the SDK reports.
The version reported by the SDK defaults to the application version (Android versionName, iOS CFBundleShortVersionString) and can be overridden with config.version; if you override it, use the same value at upload time. The Metro debug ID plugin is not required.
Apply the Gradle script shipped with the package in android/app/build.gradle. It hooks into the release bundling task and calls the FlashCat CLI to upload the source map right after the bundle is built.
android/app/build.gradle
Provide an API key with source map upload permission through an environment variable at build time:
Upload behavior (from 0.1.1):
In 0.1.0, a missing FLASHCAT_API_KEY fails assembleRelease entirely and the APK stays on the previous version. Upgrade to 0.1.1 or later.
The uploaded bundle file name must match the name the app actually loads at runtime (defaults: index.android.bundle on Android, main.jsbundle on iOS). Symbolication matches stack frames by file name: if CI renames the artifact through --bundle-output before uploading, the file name in production stacks will not match it and the source map will never be hit. iOS and Android bundles are stored per platform, so even identical names do not overwrite each other.
Every JS code change produces a new bundle, so source map upload must be part of every release build; otherwise stack traces for that version stay minified. Native crashes use a separate set of symbol files — see the next section.

Native crash symbolication

Crashes in a React Native app come in two kinds, and each needs its own symbol files: JavaScript exceptions are resolved with source maps (previous section), while native crashes are captured by the underlying Android / iOS SDK and are resolved with mapping files and dSYMs.

Prerequisite: turn on native crash reporting

nativeCrashReportEnabled defaults to false. While it is off, native crashes are neither reported nor flagged anywhere — the console shows nothing at all, which is indistinguishable from “no crash happened”. The 4th to 6th positional constructor arguments are trackInteractions / trackResources / trackErrorsnot this flag. Set it explicitly:

What to upload

The React Native template leaves code shrinking off (enableProguardInReleaseBuilds = false). With it off, Java stack traces in a release build already carry readable class and method names, so no mapping file is needed.Once you enable shrinking in android/app/build.gradle, frames turn into short names such as MainActivity.o0(SourceFile:5) and a mapping file becomes required. Upload works exactly as it does for the Android SDK — add the Flashcat Android Gradle plugin and it uploads with every release build:
android/app/build.gradle
If the app ships NDK code, the same plugin uploads the NDK symbol files as well. See Source mapping.
Upload symbol files for both platforms separately. Symbol files are matched by service, and without an explicit serviceName Android falls back to the applicationId while iOS falls back to the bundle identifier — one app becomes two services in the console, and the Android mapping file is never applied to an iOS crash or vice versa. Set serviceName explicitly so both platforms agree, and upload from each platform’s release pipeline.

Other options