fix(android): handle simplified `ReactActivityDelegate` (#1900)

This commit is contained in:
Tommy Nguyen 2024-03-14 12:05:31 +01:00 коммит произвёл GitHub
Родитель 7d4bc4fb81
Коммит 0014a92ae5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 32 добавлений и 8 удалений

Просмотреть файл

@ -219,14 +219,18 @@ android {
? "src/reactinstanceeventlistener-pre-0.68/java"
: "src/reactinstanceeventlistener-0.68/java",
// TODO: Remove this block when we drop support for 0.73
reactNativeVersion >= v(0, 74, 0)
? "src/reactactivitydelegate-0.74/java"
// TODO: Remove this block when we drop support for 0.71
// https://github.com/facebook/react-native/commit/e5dd9cdc6688e63e75a7e0bebf380be1a9a5fe2b
: reactNativeVersion >= v(0, 72, 0)
? "src/reactactivitydelegate-0.72/java"
: "src/reactactivitydelegate-pre-0.72/java",
// TODO: Remove this block when we drop support for 0.74
// https://github.com/facebook/react-native/commit/3283202248a36dbda553745afc46a3e3e2ab41a6
reactNativeVersion >= v(0, 75, 0)
? "src/reactactivitydelegate-0.75/java"
// TODO: Remove this block when we drop support for 0.73
: reactNativeVersion >= v(0, 74, 0)
? "src/reactactivitydelegate-0.74/java"
// TODO: Remove this block when we drop support for 0.71
// https://github.com/facebook/react-native/commit/e5dd9cdc6688e63e75a7e0bebf380be1a9a5fe2b
: reactNativeVersion >= v(0, 72, 0)
? "src/reactactivitydelegate-0.72/java"
: "src/reactactivitydelegate-pre-0.72/java",
// TODO: Remove this block when we drop support for 0.73
// https://github.com/facebook/react-native/commit/cfa02eec50469059542ccbacbc51643b525ad461

Просмотреть файл

@ -0,0 +1,19 @@
package com.microsoft.reacttestapp.component
import android.os.Bundle
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.microsoft.reacttestapp.BuildConfig
class ComponentActivityDelegate(
activity: ReactActivity,
mainComponentName: String?
) : ReactActivityDelegate(activity, mainComponentName) {
override fun getLaunchOptions(): Bundle? {
return plainActivity.intent.extras?.getBundle(
ComponentActivity.COMPONENT_INITIAL_PROPERTIES
)
}
override fun isFabricEnabled(): Boolean = BuildConfig.ReactTestApp_useFabric
}

Просмотреть файл

@ -82,6 +82,7 @@ describe("npm pack", () => {
"android/app/src/old-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt",
"android/app/src/reactactivitydelegate-0.72/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt",
"android/app/src/reactactivitydelegate-0.74/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt",
"android/app/src/reactactivitydelegate-0.75/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt",
"android/app/src/reactactivitydelegate-pre-0.72/java/com/microsoft/reacttestapp/component/ComponentActivityDelegate.kt",
"android/app/src/reactapplication-0.73/java/com/microsoft/reacttestapp/TestApp.kt",
"android/app/src/reactapplication-pre-0.73/java/com/microsoft/reacttestapp/TestApp.kt",