Skip to content

Commit 9e3030a

Browse files
authored
chore(deps): Support RN 0.80.0 (#4938)
* test(e2e): Bump RN version to 0.80.0 * Remove folly_flags * Run codegen on Android * Fix Android codegen script * Adds changelog * Handle the new rndiff app structure * Remove folly_flags conditionally
1 parent 398e5d0 commit 9e3030a

File tree

6 files changed

+44
-9
lines changed

6 files changed

+44
-9
lines changed

.github/workflows/e2e-v2.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ jobs:
163163
strategy:
164164
fail-fast: false # keeps matrix running if one fails
165165
matrix:
166-
rn-version: ['0.65.3', '0.79.1']
166+
rn-version: ['0.65.3', '0.80.0']
167167
rn-architecture: ['legacy', 'new']
168168
platform: ['android', 'ios']
169169
build-type: ['production']
170170
ios-use-frameworks: ['no', 'static', 'dynamic']
171171
engine: ['hermes', 'jsc']
172172
include:
173173
- platform: ios
174-
rn-version: '0.79.1'
174+
rn-version: '0.80.0'
175175
xcode-version: '16.2'
176176
runs-on: macos-15
177177
- platform: ios
@@ -182,7 +182,7 @@ jobs:
182182
runs-on: ubuntu-latest
183183
exclude:
184184
# exclude JSC for new RN versions (keeping the matrix manageable)
185-
- rn-version: '0.79.1'
185+
- rn-version: '0.80.0'
186186
engine: 'jsc'
187187
# exclude all rn versions lower than 0.70.0 for new architecture
188188
- rn-version: '0.65.3'
@@ -301,15 +301,15 @@ jobs:
301301
strategy:
302302
fail-fast: false # keeps matrix running if one fails
303303
matrix:
304-
rn-version: ['0.65.3', '0.79.1']
304+
rn-version: ['0.65.3', '0.80.0']
305305
rn-architecture: ['legacy', 'new']
306306
platform: ['android', 'ios']
307307
build-type: ['production']
308308
ios-use-frameworks: ['no'] # test only no framworks
309309
engine: ['hermes', 'jsc']
310310
include:
311311
- platform: ios
312-
rn-version: '0.79.1'
312+
rn-version: '0.80.0'
313313
runs-on: macos-15
314314
- platform: ios
315315
rn-version: '0.65.3'
@@ -323,7 +323,7 @@ jobs:
323323
# e2e test only the default combinations
324324
- rn-version: '0.65.3'
325325
engine: 'hermes'
326-
- rn-version: '0.79.1'
326+
- rn-version: '0.80.0'
327327
engine: 'jsc'
328328

329329
steps:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
### Fixes
3232

33+
- Adds support for React Native 0.80 ([#4938](https://github.com/getsentry/sentry-react-native/pull/4938))
3334
- Report slow and frozen frames as app start span data ([#4865](https://github.com/getsentry/sentry-react-native/pull/4865))
3435
- User set by `Sentry.setUser` is prefilled in Feedback Widget ([#4901](https://github.com/getsentry/sentry-react-native/pull/4901))
3536
- User data are considered from all scopes in the following order current, isolation and global.

dev-packages/e2e-tests/cli.mjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,25 @@ const testApp = `${e2eDir}/${testAppName}`;
6868
const appId = platform === 'ios' ? 'org.reactjs.native.example.RnDiffApp' : 'com.rndiffapp';
6969
const sentryAuthToken = env.SENTRY_AUTH_TOKEN;
7070

71+
function runCodegenIfNeeded(rnVersion, platform, appDir) {
72+
const versionNumber = parseFloat(rnVersion.replace(/[^\d.]/g, ''));
73+
const shouldRunCodegen = platform === 'android' && versionNumber >= 0.80;
74+
75+
if (shouldRunCodegen) {
76+
console.log(`Running codegen for React Native ${rnVersion}...`);
77+
try {
78+
execSync('./gradlew generateCodegenArtifactsFromSchema', {
79+
stdio: 'inherit',
80+
cwd: path.join(appDir, 'android'),
81+
env: env
82+
});
83+
console.log('Gradle codegen task completed successfully');
84+
} catch (error) {
85+
console.error('Codegen failed:', error.message);
86+
}
87+
}
88+
}
89+
7190
// Build and publish the SDK - we only need to do this once in CI.
7291
// Locally, we may want to get updates from the latest build so do it on every app build.
7392
if (actions.includes('create') || (env.CI === undefined && actions.includes('build'))) {
@@ -198,6 +217,8 @@ if (actions.includes('build')) {
198217

199218
appProduct = `${appDir}/ios/DerivedData/Build/Products/${buildType}-iphonesimulator/${appName}.app`;
200219
} else if (platform == 'android') {
220+
runCodegenIfNeeded(RNVersion, platform, appDir);
221+
201222
execSync(`./gradlew assemble${buildType} -PreactNativeArchitectures=x86 --no-daemon`, {
202223
stdio: 'inherit',
203224
cwd: `${appDir}/android`,

dev-packages/e2e-tests/patch-scripts/rn.patch.app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ Sentry.init({
4141
const e2eComponentPatch = '<EndToEndTestsScreen />';
4242
const lastImportRex = /^([^]*)(import\s+[^;]*?;$)/m;
4343
const patchRex = '@sentry/react-native';
44-
const headerComponentRex = /<ScrollView/gm;
44+
// Support both older RN versions with ScrollView and newer versions with NewAppScreen
45+
const headerComponentRex = /(<ScrollView|<NewAppScreen)/gm;
4546
const exportDefaultRex = /export\s+default\s+App;/m;
4647

4748
const jsPath = path.join(args.app, 'App.js');

packages/core/RNSentry.podspec

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ rn_version = get_rn_version(rn_package)
77
is_hermes_default = is_hermes_default(rn_version)
88
is_profiling_supported = is_profiling_supported(rn_version)
99

10-
folly_flags = ' -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
11-
folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
10+
# Use different Folly configuration for RN 0.80.0+
11+
if should_use_folly_flags(rn_version)
12+
# For older RN versions, keep the original Folly configuration
13+
folly_flags = ' -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
14+
folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
15+
else
16+
# For RN 0.80+, don't use the incompatible Folly flags
17+
folly_compiler_flags = ''
18+
end
1219

1320
is_new_arch_enabled = ENV["RCT_NEW_ARCH_ENABLED"] == "1"
1421
is_using_hermes = (ENV['USE_HERMES'] == nil && is_hermes_default) || ENV['USE_HERMES'] == '1'

packages/core/scripts/sentry_utils.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ def is_hermes_default(rn_version)
3131
def is_profiling_supported(rn_version)
3232
return (rn_version[:major] >= 1 || (rn_version[:major] == 0 && rn_version[:minor] >= 69))
3333
end
34+
35+
# Check if we need the old Folly flags (for RN < 0.80.0)
36+
def should_use_folly_flags(rn_version)
37+
return (rn_version[:major] == 0 && rn_version[:minor] < 80)
38+
end

0 commit comments

Comments
 (0)