From e5dd9cdc6688e63e75a7e0bebf380be1a9a5fe2b Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Thu, 30 Mar 2023 04:44:21 -0700 Subject: [PATCH] Re-enable Fabric in the default app template/RN-Tester (#36717) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36717 After D43711737 landed, it turns out that Fabric is always disabled for both RN-Tester and new app from template (so for 0.72 also RC0). The reason is that a new method `createRootView(Bundle)` was introduced inside `ReactActivityDelegate`. Both RN Tester and the template were using the old `createRootView()` method which is not called anymore at this stage (should potentially be deprecated?). This diff fixes it by overriding both method inside `DefaultReactActivityDelegate` so that both methods are setting the Fabric renderer. Changelog: [Android] [Fixed] - Re-enable Fabric in the default app template/RN-Tester Reviewed By: cipolleschi Differential Revision: D44536222 fbshipit-source-id: d22a0c522f011a8fe4d27b5d8f2fcf5dd13c3058 --- .../facebook/react/defaults/DefaultReactActivityDelegate.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt index aeba484beed..0a560c23213 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt @@ -7,6 +7,7 @@ package com.facebook.react.defaults +import android.os.Bundle import com.facebook.react.ReactActivity import com.facebook.react.ReactActivityDelegate import com.facebook.react.ReactRootView @@ -43,4 +44,7 @@ open class DefaultReactActivityDelegate( override fun createRootView(): ReactRootView = ReactRootView(context).apply { setIsFabric(fabricEnabled) } + + override fun createRootView(bundle: Bundle): ReactRootView = + ReactRootView(context).apply { setIsFabric(fabricEnabled) } }