Skip to content

Commit 9e4df29

Browse files
authored
Support React Native 0.87 on 2.x (#4497)
## Description Brings React Native 0.87 support to the 2.x line. Mirrors the changes already on main (#4247, #4310, #4311, #4319), trimmed to what the v2 code needs. Native (iOS): - Remove the unused `RCTRootContentView.h` import. The header is gone from the prebuilt React-Core framework in 0.87. - `RCTCxxBridge` no longer exists, so the `isViewFlatteningDisabled` JSI binding is now installed via `RCTTurboModuleWithJSIBindings`. Gated behind `REACT_NATIVE_MINOR_VERSION >= 87`, older versions keep the previous code path. TypeScript: - Bump TypeScript to 6.0.3 (cherry-pick of #4311) and switch `moduleResolution` to `bundler`. RN 0.87 exposes its types only through the package `exports` map. - Port the Strict TS API fixes (cherry-pick of #4319, v2 subset): `CodegenTypes` namespace and public `codegenNativeComponent` in specs, `ComponentRef`-based ref types in Pressable, Text, GestureComponents, style fixes in touchables. - Explicit type annotations in `mocks.tsx` and `GestureHandlerButton.web.tsx`. TS 6 refuses to emit declarations that reach RN's non-exported type aliases. - Cast in legacy `Swipeable` where `interpolate` overloads on a `Value | AnimatedInterpolation` union no longer unify. - `unbound-method` lint adjustments for methods RN 0.87 now types as class members. Example apps: - Bump `basic-example` to RN 0.87.1, Reanimated 4.6.0, Worklets 0.12.1. - Pin `expo` to 56.0.21 and patch `expo-modules-core` 56.0.25 (`executeSync` -> `runSync`), which Worklets 0.12 removed. The resolution is keyed on the range expo declares, so the exact pin keeps the patch applying. - Type fixes in `common-app` examples for the 0.87 types. ## Test plan - `yarn ts-check`, `yarn lint-js`, `yarn jest` - Build `basic-example` on iOS and Android - Build `expo-example` on iOS and Android
1 parent f68a21a commit 9e4df29

48 files changed

Lines changed: 2522 additions & 1908 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/android/src/main/cpp/worklets/WorkletJSCallInvoker.cpp b/android/src/main/cpp/worklets/WorkletJSCallInvoker.cpp
2+
index a2d707ce76ceb35456eb075d06473ac98ad8b5eb..0a69a24b93d0d26529d331098d2d0c62696e65bb 100644
3+
--- a/android/src/main/cpp/worklets/WorkletJSCallInvoker.cpp
4+
+++ b/android/src/main/cpp/worklets/WorkletJSCallInvoker.cpp
5+
@@ -24,7 +24,7 @@ namespace expo {
6+
return;
7+
}
8+
9+
- workletRuntime->executeSync([func = std::move(func)](jsi::Runtime &rt) -> jsi::Value {
10+
+ workletRuntime->runSync([func = std::move(func)](jsi::Runtime &rt) -> jsi::Value {
11+
func(rt);
12+
return jsi::Value::undefined();
13+
});
14+
diff --git a/ios/WorkletsAdapter/ExpoWorkletsBridgeProvider.mm b/ios/WorkletsAdapter/ExpoWorkletsBridgeProvider.mm
15+
index 126545fae12dc3af71e0ea382b976ef430e62d17..d97163a2e9a9db09f43786bc919f2fa229f21901 100644
16+
--- a/ios/WorkletsAdapter/ExpoWorkletsBridgeProvider.mm
17+
+++ b/ios/WorkletsAdapter/ExpoWorkletsBridgeProvider.mm
18+
@@ -233,7 +233,7 @@ - (void)executeWorkletWithRuntimeHandle:(id)runtimeHandle
19+
return;
20+
}
21+
22+
- workletRuntime->executeSync([worklet, arguments](jsi::Runtime &rt) -> jsi::Value {
23+
+ workletRuntime->runSync([worklet, arguments](jsi::Runtime &rt) -> jsi::Value {
24+
return callWorklet(rt, worklet, arguments);
25+
});
26+
}

‎apps/basic-example/android/app/build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ android {
102102
// see https://reactnative.dev/docs/signed-apk-android.
103103
signingConfig signingConfigs.debug
104104
minifyEnabled enableProguardInReleaseBuilds
105-
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
105+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
106106
}
107107
}
108108
}

‎apps/basic-example/android/build.gradle‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
buildscript {
22
ext {
3-
buildToolsVersion = "36.0.0"
3+
buildToolsVersion = "37.0.0"
44
minSdkVersion = 24
5-
compileSdkVersion = 36
5+
compileSdkVersion = 37
66
targetSdkVersion = 36
77
ndkVersion = "27.1.12297006"
8-
kotlinVersion = "2.1.20"
8+
kotlinVersion = "2.2.0"
99
isGHExampleApp = true
1010
}
1111
repositories {

‎apps/basic-example/android/gradle.properties‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,9 @@ hermesEnabled=true
4141
# Use this property to enable edge-to-edge display support.
4242
# This allows your app to draw behind system bars for an immersive UI.
4343
# Note: Only works with ReactActivity and should not be used with custom Activity.
44-
edgeToEdgeEnabled=false
44+
edgeToEdgeEnabled=true
45+
46+
# Opt out of built-in kotlin and new DSL behavior that ships with AGP 9.
47+
# Starting from AGP 10.x these opt outs will be removed.
48+
android.builtInKotlin=false
49+
android.newDsl=false
2.73 KB
Binary file not shown.

‎apps/basic-example/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-9.3.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

‎apps/basic-example/android/gradlew‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎apps/basic-example/ios/BasicExample/PrivacyInfo.xcprivacy‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
</dict>
1515
<dict>
1616
<key>NSPrivacyAccessedAPIType</key>
17-
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
17+
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
1818
<key>NSPrivacyAccessedAPITypeReasons</key>
1919
<array>
20-
<string>CA92.1</string>
20+
<string>35F9.1</string>
2121
</array>
2222
</dict>
2323
<dict>
2424
<key>NSPrivacyAccessedAPIType</key>
25-
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
25+
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
2626
<key>NSPrivacyAccessedAPITypeReasons</key>
2727
<array>
28-
<string>35F9.1</string>
28+
<string>CA92.1</string>
2929
</array>
3030
</dict>
3131
</array>

0 commit comments

Comments
 (0)