Skip to content

Commit 8bd8996

Browse files
Abbondanzofacebook-github-bot
authored andcommitted
Upgrade AndroidX Activity to 1.10.1
Summary: ReactAndroid exposes AndroidX Activity Result types in its public API but currently receives `androidx.activity:activity:1.7.0` only transitively through AppCompat. Declare Activity 1.10.1 as a direct API dependency. This aligns OSS builds with the version used internally and lets the Kotlin `contract` property compile directly, so the compatibility bridge from the parent diff can be removed. Changelog: [Android][Changed] - Upgrade AndroidX Activity to 1.10.1 Differential Revision: D121847691
1 parent 844a55a commit 8bd8996

6 files changed

Lines changed: 8 additions & 35 deletions

File tree

‎packages/react-native/ReactAndroid/build.gradle.kts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ tasks.withType<KotlinCompile>().configureEach {
729729
}
730730

731731
dependencies {
732+
api(libs.androidx.activity)
732733
api(libs.androidx.appcompat)
733734
api(libs.androidx.appcompat.resources)
734735
api(libs.androidx.autofill)

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/activityresult/ActivityResultLauncherCompat.java‎

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

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/activityresult/DeferredActivityResultLauncher.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ import com.facebook.react.common.ReactConstants
2626
*/
2727
internal class DeferredActivityResultLauncher<I>(
2828
private val key: String,
29-
contract: ActivityResultContract<I, *>,
29+
override val contract: ActivityResultContract<I, *>,
3030
private val onUnregister: () -> Unit,
3131
private val onLaunchFailure: (RuntimeException) -> Unit = {},
32-
) : ActivityResultLauncherCompat<I>(contract) {
32+
) : ActivityResultLauncher<I>() {
3333

3434
private class PendingLaunch<I>(val input: I, val options: ActivityOptionsCompat?)
3535

‎packages/react-native/ReactAndroid/src/test/java/com/facebook/react/activityresult/ReactActivityResultCallerImplTest.kt‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,6 @@ class ReactActivityResultCallerImplTest {
8181
caller = ReactActivityResultCallerImpl(reactContext)
8282
}
8383

84-
@Test
85-
fun launcherExposesRegisteredContract() {
86-
val contract = GetContent()
87-
val launcher = caller.registerForActivityResult(moduleA, contract) {}
88-
89-
assertThat(launcher.contract).isSameAs(contract)
90-
}
91-
9284
@Test
9385
fun twoOwnersMayRegisterTheSameStockContract() {
9486
caller.registerForActivityResult(moduleA, GetContent()) {}

‎packages/react-native/ReactAndroid/src/test/java/com/facebook/react/activityresult/ReactActivityResultCallerThreadingTest.kt‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import android.app.Activity
1111
import android.content.ActivityNotFoundException
1212
import android.os.Bundle
1313
import android.os.Looper
14+
import androidx.activity.result.ActivityResultLauncher
1415
import androidx.activity.result.ActivityResultRegistry
1516
import androidx.activity.result.ActivityResultRegistryOwner
1617
import androidx.activity.result.contract.ActivityResultContract
@@ -64,7 +65,8 @@ class ReactActivityResultCallerThreadingTest {
6465
.orEmpty()
6566
}
6667

67-
private class ThrowingLauncher : ActivityResultLauncherCompat<String>(GetContent()) {
68+
private class ThrowingLauncher : ActivityResultLauncher<String>() {
69+
override val contract: ActivityResultContract<String, *> = GetContent()
6870
var launchCount = 0
6971

7072
override fun launch(input: String, options: ActivityOptionsCompat?) {

‎packages/react-native/gradle/libs.versions.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ buildTools = "37.0.0"
77
ndkVersion = "27.1.12297006"
88
# Dependencies versions
99
agp = "9.2.1"
10+
androidx-activity = "1.10.1"
1011
androidx-annotation = "1.6.0"
1112
androidx-appcompat = "1.7.0"
1213
androidx-autofill = "1.3.0"
@@ -52,6 +53,7 @@ gflags="2.2.0"
5253
nlohmannjson="3.11.2"
5354

5455
[libraries]
56+
androidx-activity = { module = "androidx.activity:activity", version.ref = "androidx-activity" }
5557
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" }
5658
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
5759
androidx-appcompat-resources = { module = "androidx.appcompat:appcompat-resources", version.ref = "androidx-appcompat" }

0 commit comments

Comments
 (0)