Skip to content
Open
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
2 changes: 1 addition & 1 deletion rn-app-with-native/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
extends: '@react-native',
};
16 changes: 14 additions & 2 deletions rn-app-with-native/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local
**/.xcode.env.local

# Android/IntelliJ
#
Expand All @@ -33,6 +33,7 @@ local.properties
.cxx/
*.keystore
!debug.keystore
.kotlin/

# node.js
#
Expand All @@ -56,11 +57,22 @@ yarn-error.log
*.jsbundle

# Ruby / CocoaPods
/ios/Pods/
**/Pods/
/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Secrets
credentials.json
54 changes: 40 additions & 14 deletions rn-app-with-native/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,61 @@ import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {
DatadogProvider,
DatadogProviderConfiguration,
DdSdkReactNative,
InternalLog,
SdkVerbosity,
} from '@datadog/mobile-react-native';
import {DdRumReactNavigationTracking} from '@datadog/mobile-react-navigation';
import {applicationId, clientToken, environment} from './credentials.json';
import { ImagePrivacyLevel, SessionReplay, SessionReplayConfiguration, TextAndInputPrivacyLevel, TouchPrivacyLevel } from '@datadog/mobile-react-native-session-replay';

const Stack = createNativeStackNavigator();

const config = {
trackResources: true,
trackErrors: true,
trackInteractions: true,
const config = new DatadogProviderConfiguration(
clientToken,
environment,
applicationId,
true,
true,
true
);

// Optional: enable or disable native crash reports
config.nativeCrashReportEnabled = true;
// Optional: Select your Datadog website (one of "US", "EU" or "GOV")
config.site = "US";
// Optional: Sample RUM sessions (in this example, 80% of session are sent to Datadog. Default is 100%)
config.sessionSamplingRate = 100;

config.appHangThreshold = 3.0;
config.trackNonFatalAnrs = true;

const sessionReplayConfig: SessionReplayConfiguration = {
replaySampleRate: 100,
imagePrivacyLevel: ImagePrivacyLevel.MASK_NONE,
touchPrivacyLevel: TouchPrivacyLevel.SHOW,
textAndInputPrivacyLevel: TextAndInputPrivacyLevel.MASK_SENSITIVE_INPUTS,
startRecordingImmediately: true
}

const onSDKInitialized = async () => {
await SessionReplay.enable(sessionReplayConfig);

await DdSdkReactNative.setAttributes({
profile_mode: "wall",
chat_enabled: true,
campaign_origin: "example_ad_network",
});
};

InternalLog.verbosity = SdkVerbosity.DEBUG;

const RNApp = () => {
useEffect(() => {
DatadogProvider.initialize({
clientToken,
env: environment,
applicationId,
longTaskThresholdMs: 100,
nativeInteractionTracking: true,
});
}, []);
const navigationRef = useRef(null);

return (
<DatadogProvider configuration={config}>
<DatadogProvider configuration={config} onInitialization={onSDKInitialized}>
<NavigationContainer
ref={navigationRef}
onReady={() => {
Expand Down
18 changes: 14 additions & 4 deletions rn-app-with-native/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby File.read(File.join(__dir__, '.ruby-version')).strip

gem 'cocoapods', '~> 1.11', '>= 1.11.3'
ruby ">= 2.6.10"

# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Library Vulnerability

activesupport → 6.1.7.2

View all suggested fixes
Suggested change
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'activesupport', 7.1.0 '!= 7.1.0'
Suggested change
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'activesupport', 6.1.7.5 '!= 7.1.0'
Active Support Possibly Discloses Locally Encrypted Files (...read more)

View in Datadog  Leave us feedback  Documentation

gem 'xcodeproj', '< 1.26.0'
gem 'concurrent-ruby', '< 1.3.4'

# Ruby 3.4.0 has removed some libraries from the standard library.
gem 'bigdecimal'
gem 'logger'
gem 'benchmark'
gem 'mutex_m'
68 changes: 19 additions & 49 deletions rn-app-with-native/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: 'kotlin-android'

import com.android.build.OutputFile

/**
* This is the configuration block to customize your React Native Android app.
* By default you don't need to apply any configuration, just uncomment the lines you need.
*/
react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
// root = file("../")
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
// reactNativeDir = file("../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
// codegenDir = file("../node_modules/react-native-codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// cliFile = file("../node_modules/react-native/cli.js")
// The root of your project, i.e. where "package.json" lives. Default is '../..'
// root = file("../../")
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
// reactNativeDir = file("../../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
// codegenDir = file("../../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
// cliFile = file("../../node_modules/react-native/cli.js")

/* Variants */
// The list of variants to that are debuggable. For those we're going to
Expand Down Expand Up @@ -51,6 +50,9 @@ react {
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]

/* Autolinking */
autolinkLibrariesWithApp()
}

/**
Expand All @@ -70,14 +72,14 @@ def enableProguardInReleaseBuilds = false
* The preferred build flavor of JavaScriptCore (JSC)
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'

/**
* Private function to get the list of Native Architectures you want to build.
Expand All @@ -92,7 +94,8 @@ def reactNativeArchitectures() {
android {
ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion

namespace "com.reactnativewithiosscreen"
defaultConfig {
Expand All @@ -103,14 +106,6 @@ android {
versionName "1.0"
}

splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include (*reactNativeArchitectures())
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
Expand All @@ -131,22 +126,6 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
}

}
}
}

def getExtOrDefault(name, defaultValue) {
Expand All @@ -165,21 +144,12 @@ dependencies {
implementation("com.squareup.okhttp3:okhttp:4.10.0")

// The versions must be aligned with @datadog/mobile-react-native gradle versions
implementation "com.datadoghq:dd-sdk-android-rum:2.14.0"
implementation "com.datadoghq:dd-sdk-android-okhttp:2.14.0"
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
implementation "com.datadoghq:dd-sdk-android-rum:2.19.2"
implementation "com.datadoghq:dd-sdk-android-okhttp:2.19.2"

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
</application>
tools:ignore="GoogleAppIndexingWarning"/>
</manifest>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Expand Down
Loading