Skip to content

Commit eb71e76

Browse files
antonisclaude
andcommitted
fix(core): Restore react-native-build-config and update Node constraints
- Re-add react-native-build-config with yarn patch for Gradle 9 compat. The Android BuildConfig.SENTRY_DISABLE_NATIVE_START is a build-time flag that can't be replaced by runtime launch arguments. - Restore original platform-specific shouldUseAutoStart() logic. - Update engines.node to >=22.11.0 and volta node to 22.22.2 to match RN 0.84 requirements. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 30c5cad commit eb71e76

5 files changed

Lines changed: 63 additions & 7 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/android/build.gradle b/android/build.gradle
2+
index 8eb2638fe8f4eddfe5daaa3d54ba39cf4e11e6f8..f7d77d75f57004438998cded63ce694d0753dcf4 100644
3+
--- a/android/build.gradle
4+
+++ b/android/build.gradle
5+
@@ -1,13 +1,3 @@
6+
-buildscript {
7+
- repositories {
8+
- jcenter()
9+
- }
10+
-
11+
- dependencies {
12+
- classpath 'com.android.tools.build:gradle:1.3.0'
13+
- }
14+
-}
15+
-
16+
apply plugin: 'com.android.library'
17+
18+
android {
19+
@@ -19,7 +9,7 @@ android {
20+
versionCode 1
21+
versionName "1.0"
22+
}
23+
- lintOptions {
24+
+ lint {
25+
abortOnError false
26+
}
27+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@
115115
"minimatch@npm:10.2.4/brace-expansion": "^5.0.5",
116116
"@appium/base-driver@npm:10.2.2/path-to-regexp": "^8.4.0",
117117
"router@npm:2.2.0/path-to-regexp": "^8.4.0",
118-
"yaml": "^2.8.3"
118+
"yaml": "^2.8.3",
119+
"react-native-build-config@^0.3.2": "patch:react-native-build-config@npm%3A0.3.2#./.yarn/patches/react-native-build-config-npm-0.3.2-0e671629bd.patch"
119120
},
120121
"version": "0.0.0",
121122
"name": "sentry-react-native",

samples/react-native/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"delay": "^6.0.0",
5555
"react": "19.2.3",
5656
"react-native": "0.84.1",
57+
"react-native-build-config": "^0.3.2",
5758
"react-native-gesture-handler": "^2.28.0",
5859
"react-native-image-picker": "^8.2.1",
5960
"react-native-launch-arguments": "^4.1.1",
@@ -93,10 +94,10 @@
9394
"typescript": "5.0.4"
9495
},
9596
"engines": {
96-
"node": ">=18"
97+
"node": ">=22.11.0"
9798
},
9899
"volta": {
99-
"node": "18.20.8",
100+
"node": "22.22.2",
100101
"yarn": "3.6.4"
101102
},
102103
"codegenConfig": {

samples/react-native/src/utils.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import { Platform } from 'react-native';
12
import { LaunchArguments } from 'react-native-launch-arguments';
3+
import BuildConfig from 'react-native-build-config';
24
import * as Sentry from '@sentry/react-native';
35
import { useFocusEffect } from '@react-navigation/native';
46

@@ -11,10 +13,20 @@ export function logWithoutTracing(...args: unknown[]) {
1113
}
1214

1315
export function shouldUseAutoStart(): boolean {
14-
const args = LaunchArguments.value<{
15-
sentryDisableNativeStart?: boolean;
16-
}>();
17-
return !!args.sentryDisableNativeStart;
16+
if (Platform.OS === 'android') {
17+
return !!(
18+
BuildConfig as {
19+
SENTRY_DISABLE_NATIVE_START?: boolean;
20+
}
21+
).SENTRY_DISABLE_NATIVE_START;
22+
} else if (Platform.OS === 'ios') {
23+
const args = LaunchArguments.value<{
24+
sentryDisableNativeStart?: boolean;
25+
}>();
26+
return !!args.sentryDisableNativeStart;
27+
} else {
28+
return false;
29+
}
1830
}
1931

2032
export const TimeToFullDisplay = Sentry.createTimeToFullDisplay({

yarn.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27759,6 +27759,20 @@ __metadata:
2775927759
languageName: node
2776027760
linkType: hard
2776127761

27762+
"react-native-build-config@npm:0.3.2":
27763+
version: 0.3.2
27764+
resolution: "react-native-build-config@npm:0.3.2"
27765+
checksum: d2095580be7e6662c968bce5d64cc6524b7f34380999756fb9d4ad24a34e3566b203f93e9bc63bd1e0213d28e1e76dae0c0f39b0b65c55528a876e96dd6c5810
27766+
languageName: node
27767+
linkType: hard
27768+
27769+
"react-native-build-config@patch:react-native-build-config@npm%3A0.3.2#./.yarn/patches/react-native-build-config-npm-0.3.2-0e671629bd.patch::locator=sentry-react-native%40workspace%3A.":
27770+
version: 0.3.2
27771+
resolution: "react-native-build-config@patch:react-native-build-config@npm%3A0.3.2#./.yarn/patches/react-native-build-config-npm-0.3.2-0e671629bd.patch::version=0.3.2&hash=919c89&locator=sentry-react-native%40workspace%3A."
27772+
checksum: 4a486a9d2088a90e079529305abd118b13b9b53e6b782af4a917aa6ebf6413fd2b211bb7d809e50e5b5f5c5d671a78fb5b9c14b54ec07cc8548f6538afeb278f
27773+
languageName: node
27774+
linkType: hard
27775+
2776227776
"react-native-edge-to-edge@npm:1.6.0":
2776327777
version: 1.6.0
2776427778
resolution: "react-native-edge-to-edge@npm:1.6.0"
@@ -29970,6 +29984,7 @@ __metadata:
2997029984
patch-package: ^8.0.0
2997129985
react: 19.2.3
2997229986
react-native: 0.84.1
29987+
react-native-build-config: ^0.3.2
2997329988
react-native-gesture-handler: ^2.28.0
2997429989
react-native-image-picker: ^8.2.1
2997529990
react-native-launch-arguments: ^4.1.1

0 commit comments

Comments
 (0)