Skip to content

Commit 3b4dd9c

Browse files
antonislucas-zimermankrystofwoldrich
authored
Chore: Upgrade sample and E2E tests to RN 0.75 (#4155)
* Updates RN to 0.75.4 in the sample app and E2E test * Removes Flipper from iOS * Fixes lint issue (see facebook/react-native#33955) * enable corepack in testflight dependencies step * Sets the newArchEnabled=false for legacy builds * enable corepack in testflight build step * Enable corepack in a separate step * Removes corepack step * Updates OnLoad.cpp and CMakeList.txt to match the RN version samples * Enable corepack and remove cache check * Reverts CMakeLists.txt change * Update yarn cache in testflight build * Updates PrivacyInfo * misc(ci): Remove unused testflight node_modules cache (#4178) --------- Co-authored-by: LucasZF <[email protected]> Co-authored-by: Krystof Woldrich <[email protected]>
1 parent e29594d commit 3b4dd9c

File tree

26 files changed

+1383
-173
lines changed

26 files changed

+1383
-173
lines changed

.github/workflows/codegen.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jobs:
2929
cd samples/react-native/ios
3030
node ../node_modules/react-native/scripts/generate-codegen-artifacts.js \
3131
--path .. \
32-
--outputPath codegen
32+
--outputPath codegen \
33+
--targetPlatform ios
3334
steps:
3435
- uses: actions/checkout@v4
3536
- run: corepack enable

.github/workflows/e2e.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,15 @@ jobs:
167167
strategy:
168168
fail-fast: false # keeps matrix running if one fails
169169
matrix:
170-
rn-version: ['0.65.3', '0.73.9']
170+
rn-version: ['0.65.3', '0.75.4']
171171
rn-architecture: ['legacy', 'new']
172172
platform: ['android', 'ios']
173173
build-type: ['production']
174174
ios-use-frameworks: ['no', 'static', 'dynamic']
175175
engine: ['hermes', 'jsc']
176176
include:
177177
- platform: ios
178-
rn-version: '0.73.9'
178+
rn-version: '0.75.4'
179179
runs-on: macos-14 # uses m1 https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available/
180180
runtime: 'latest'
181181
device: 'iPhone 14'
@@ -188,7 +188,7 @@ jobs:
188188
runs-on: ubuntu-latest
189189
exclude:
190190
# exclude JSC for new RN versions (keeping the matrix manageable)
191-
- rn-version: '0.73.9'
191+
- rn-version: '0.75.4'
192192
engine: 'jsc'
193193
# exclude all rn versions lower than 0.70.0 for new architecture
194194
- rn-version: '0.65.3'
@@ -307,15 +307,15 @@ jobs:
307307
strategy:
308308
fail-fast: false # keeps matrix running if one fails
309309
matrix:
310-
rn-version: ['0.65.3', '0.73.9']
310+
rn-version: ['0.65.3', '0.75.4']
311311
rn-architecture: ['legacy', 'new']
312312
platform: ['android', 'ios']
313313
build-type: ['production']
314314
ios-use-frameworks: ['no'] # test only no framworks
315315
engine: ['hermes', 'jsc']
316316
include:
317317
- platform: ios
318-
rn-version: '0.73.9'
318+
rn-version: '0.75.4'
319319
runs-on: macos-14 # uses m1 https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available/
320320
runtime: 'latest'
321321
device: 'iPhone 14'
@@ -333,10 +333,10 @@ jobs:
333333
# e2e test only the default combinations
334334
- rn-version: '0.65.3'
335335
engine: 'hermes'
336-
- rn-version: '0.73.9'
336+
- rn-version: '0.75.4'
337337
engine: 'jsc'
338338
# E2E timeout due to a race condition https://github.com/facebook/react-native/issues/42123#issuecomment-1881203719
339-
- rn-version: '0.73.9'
339+
- rn-version: '0.75.4'
340340
platform: 'ios'
341341
rn-architecture: 'new'
342342
env:

.github/workflows/sample-application.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ jobs:
105105
[[ "${{ matrix.platform }}" == "ios" ]] && cd react-native/ios
106106
[[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos/macos
107107
108-
export NO_FLIPPER=1 # Flipper is causing build issues on iOS, so we disable it
109108
[[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
110109
[[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
111110
[[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
@@ -121,6 +120,11 @@ jobs:
121120
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
122121
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
123122
echo 'New Architecture enabled'
123+
elif [[ ${{ matrix.rn-architecture }} == 'legacy' ]]; then
124+
perl -i -pe's/newArchEnabled=true/newArchEnabled=false/g' gradle.properties
125+
echo 'Legacy Architecture enabled'
126+
else
127+
echo 'No changes for architecture: ${{ matrix.rn-architecture }}'
124128
fi
125129
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
126130
echo "Building $CONFIG"

.github/workflows/testflight.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,13 @@ jobs:
2626
ruby-version: '3.3.0' # based on what is used in the sample
2727
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
2828
cache-version: 1 # cache the installed gems
29+
- run: corepack enable
2930
- uses: actions/setup-node@v4
3031
with:
3132
node-version: 18
32-
- uses: actions/cache@v4
33-
id: deps-cache
34-
with:
35-
path: |
36-
node_modules
37-
samples/react-native/node_modules
38-
key: ${{ github.workflow }}-${{ github.job }}-${{ hashFiles('yarn.lock', 'samples/react-native/yarn.lock') }}
33+
cache: 'yarn'
34+
cache-dependency-path: yarn.lock
3935
- name: Install Dependencies
40-
if: steps.deps-cache.outputs['cache-hit'] != 'true'
4136
run: |
4237
yarn install
4338
cd samples/react-native && yarn install
@@ -52,7 +47,7 @@ jobs:
5247

5348
- name: Pod Install
5449
working-directory: samples/react-native/ios
55-
run: NO_FLIPPER=1 PRODUCTION=1 bundle exec pod install
50+
run: PRODUCTION=1 bundle exec pod install
5651

5752
- name: Run Fastlane
5853
working-directory: samples/react-native

dev-packages/e2e-tests/cli.mjs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ if (!env.USE_FRAMEWORKS || env.USE_FRAMEWORKS === 'no') {
5050
delete env.USE_FRAMEWORKS;
5151
}
5252

53-
if (platform == 'ios') {
54-
// Flipper is causing build issues on iOS, so we disable it
55-
env.NO_FLIPPER = 1;
56-
}
57-
5853
const e2eDir = path.resolve(__dirname);
5954
const e2eTestPackageName = JSON.parse(fs.readFileSync(`${e2eDir}/package.json`, 'utf8')).name;
6055
const patchScriptsDir = path.resolve(e2eDir, 'patch-scripts');

dev-packages/e2e-tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"appium-xcuitest-driver": "5.13.0",
2222
"babel-jest": "^29.7.0",
2323
"jest": "^29.7.0",
24-
"react": "18.2.0",
25-
"react-native": "0.73.9",
24+
"react": "18.3.1",
25+
"react-native": "0.75.4",
2626
"typescript": "4.9.5",
2727
"webdriverio": "^8.27.0"
2828
},

samples/react-native/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ yarn-error.log
5656
*.jsbundle
5757

5858
# Ruby / CocoaPods
59-
/ios/Pods/
59+
**/Pods/
6060
/vendor/bundle/
6161

6262
# Temporary files created by Metro to check the health of the file watcher

samples/react-native/android/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ react {
102102
//
103103
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
104104
// hermesFlags = ["-O", "-output-source-map"]
105+
106+
/* Autolinking */
107+
autolinkLibrariesWithApp()
105108
}
106109

107110
/**
@@ -196,7 +199,6 @@ android {
196199
dependencies {
197200
// The version of react-native is set by the React Native Gradle Plugin
198201
implementation("com.facebook.react:react-android")
199-
implementation("com.facebook.react:flipper-integration")
200202

201203
if (hermesEnabled.toBoolean()) {
202204
implementation("com.facebook.react:hermes-android")
@@ -205,8 +207,6 @@ dependencies {
205207
}
206208
}
207209

208-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
209-
210210
if (newArchEnabled.toBoolean()) {
211211
android {
212212
externalNativeBuild {

samples/react-native/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
android:icon="@mipmap/ic_launcher"
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:allowBackup="false"
11-
android:theme="@style/AppTheme">
11+
android:theme="@style/AppTheme"
12+
android:supportsRtl="true">
1213
<activity
1314
android:name=".MainActivity"
1415
android:label="@string/app_name"

samples/react-native/android/app/src/main/java/io/sentry/reactnative/sample/MainApplication.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import com.facebook.react.ReactPackage
99
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
1010
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
1111
import com.facebook.react.defaults.DefaultReactNativeHost
12-
import com.facebook.react.flipper.ReactNativeFlipper
1312
import com.facebook.soloader.SoLoader
1413
import io.sentry.Hint
1514
import io.sentry.SentryEvent
@@ -34,7 +33,7 @@ class MainApplication() : Application(), ReactApplication {
3433
}
3534

3635
override val reactHost: ReactHost
37-
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
36+
get() = getDefaultReactHost(applicationContext, reactNativeHost)
3837

3938
override fun onCreate() {
4039
super.onCreate()
@@ -46,7 +45,6 @@ class MainApplication() : Application(), ReactApplication {
4645
// If you opted-in for the New Architecture, we load the native entry point for this app.
4746
load()
4847
}
49-
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
5048
}
5149

5250
private fun initializeSentry() {

samples/react-native/android/app/src/main/jni/OnLoad.cpp

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,66 +27,91 @@
2727
// }
2828
// }
2929

30-
#include <AppSpecs.h>
3130
#include <DefaultComponentsRegistry.h>
3231
#include <DefaultTurboModuleManagerDelegate.h>
32+
#include <autolinking.h>
3333
#include <fbjni/fbjni.h>
3434
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
35-
#include <rncli.h>
36-
#include <NativeSampleModule.h>
35+
#include <rncore.h>
3736

38-
namespace facebook {
39-
namespace react {
37+
#ifdef REACT_NATIVE_APP_CODEGEN_HEADER
38+
#include REACT_NATIVE_APP_CODEGEN_HEADER
39+
#endif
40+
#ifdef REACT_NATIVE_APP_COMPONENT_DESCRIPTORS_HEADER
41+
#include REACT_NATIVE_APP_COMPONENT_DESCRIPTORS_HEADER
42+
#endif
43+
44+
namespace facebook::react {
4045

4146
void registerComponents(
42-
std::shared_ptr<ComponentDescriptorProviderRegistry const> registry) {
47+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
4348
// Custom Fabric Components go here. You can register custom
4449
// components coming from your App or from 3rd party libraries here.
4550
//
4651
// providerRegistry->add(concreteComponentDescriptorProvider<
47-
// AocViewerComponentDescriptor>());
52+
// MyComponentDescriptor>());
53+
54+
// We link app local components if available
55+
#ifdef REACT_NATIVE_APP_COMPONENT_REGISTRATION
56+
REACT_NATIVE_APP_COMPONENT_REGISTRATION(registry);
57+
#endif
4858

49-
// By default we just use the components autolinked by RN CLI
50-
rncli_registerProviders(registry);
59+
// And we fallback to the components autolinked
60+
autolinking_registerProviders(registry);
5161
}
5262

5363
std::shared_ptr<TurboModule> cxxModuleProvider(
54-
const std::string &name,
55-
const std::shared_ptr<CallInvoker> &jsInvoker) {
56-
// Not implemented yet: provide pure-C++ NativeModules here.
57-
if (name == "NativeSampleModule")
58-
{
59-
return std::make_shared<facebook::react::NativeSampleModule>(jsInvoker);
60-
}
61-
return nullptr;
64+
const std::string& name,
65+
const std::shared_ptr<CallInvoker>& jsInvoker) {
66+
// Here you can provide your CXX Turbo Modules coming from
67+
// either your application or from external libraries. The approach to follow
68+
// is similar to the following (for a module called `NativeCxxModuleExample`):
69+
//
70+
// if (name == NativeCxxModuleExample::kModuleName) {
71+
// return std::make_shared<NativeCxxModuleExample>(jsInvoker);
72+
// }
73+
74+
// And we fallback to the CXX module providers autolinked
75+
return autolinking_cxxModuleProvider(name, jsInvoker);
6276
}
6377

6478
std::shared_ptr<TurboModule> javaModuleProvider(
65-
const std::string &name,
66-
const JavaTurboModule::InitParams &params) {
79+
const std::string& name,
80+
const JavaTurboModule::InitParams& params) {
6781
// Here you can provide your own module provider for TurboModules coming from
6882
// either your application or from external libraries. The approach to follow
6983
// is similar to the following (for a library called `samplelibrary`):
7084
//
71-
// auto module = samplelibrary_ModuleProvider(moduleName, params);
85+
// auto module = samplelibrary_ModuleProvider(name, params);
7286
// if (module != nullptr) {
7387
// return module;
7488
// }
75-
// return rncore_ModuleProvider(moduleName, params);
89+
// return rncore_ModuleProvider(name, params);
7690

77-
auto module = AppSpecs_ModuleProvider(name, params);
91+
// We link app local modules if available
92+
#ifdef REACT_NATIVE_APP_MODULE_PROVIDER
93+
auto module = REACT_NATIVE_APP_MODULE_PROVIDER(name, params);
7894
if (module != nullptr) {
7995
return module;
8096
}
97+
#endif
8198

82-
// By default we just use the module providers autolinked by RN CLI
83-
return rncli_ModuleProvider(name, params);
99+
// We first try to look up core modules
100+
if (auto module = rncore_ModuleProvider(name, params)) {
101+
return module;
102+
}
103+
104+
// And we fallback to the module providers autolinked
105+
if (auto module = autolinking_ModuleProvider(name, params)) {
106+
return module;
107+
}
108+
109+
return nullptr;
84110
}
85111

86-
} // namespace react
87-
} // namespace facebook
112+
} // namespace facebook::react
88113

89-
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
114+
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
90115
return facebook::jni::initialize(vm, [] {
91116
facebook::react::DefaultTurboModuleManagerDelegate::cxxModuleProvider =
92117
&facebook::react::cxxModuleProvider;

samples/react-native/android/app/src/release/java/io/sentry/reactnative/sample/ReactNativeFlipper.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

samples/react-native/android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
buildscript {
33
ext {
44
buildToolsVersion = "34.0.0"
5-
minSdkVersion = 21
5+
minSdkVersion = 23
66
compileSdkVersion = 34
77
targetSdkVersion = 34
8-
ndkVersion = "25.1.8937393"
9-
kotlinVersion = "1.8.0"
8+
ndkVersion = "26.1.10909125"
9+
kotlinVersion = "1.9.24"
1010
}
1111
repositories {
1212
google()

samples/react-native/android/gradle.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ org.gradle.logging.level=lifecycle
2222
# Android operating system, and which are packaged with your app's APK
2323
# https://developer.android.com/topic/libraries/support-library/androidx-rn
2424
android.useAndroidX=true
25-
# Automatically convert third-party libraries to use AndroidX
26-
android.enableJetifier=true
2725

2826
# Use this property to specify which architecture you want to build.
2927
# You can also override it from the CLI using

samples/react-native/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)