Skip to content

Commit fffe48e

Browse files
javachemeta-codesync[bot]
authored andcommitted
Remove fabricEnabled from ReactFragment
Summary: Fabric is now unconditionally enabled for this fragment path, so the per-fragment override is dead. Remove the argument and builder API. Changelog: [Android][Removed] - Remove fabricEnabled from ReactFragment Differential Revision: D114045331
1 parent e55da68 commit fffe48e

2 files changed

Lines changed: 1 addition & 21 deletions

File tree

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ public class com/facebook/react/ReactDelegate {
161161
public class com/facebook/react/ReactFragment : androidx/fragment/app/Fragment, com/facebook/react/modules/core/PermissionAwareActivity {
162162
protected static final field ARG_COMPONENT_NAME Ljava/lang/String;
163163
protected static final field ARG_DISABLE_HOST_LIFECYCLE_EVENTS Ljava/lang/String;
164-
protected static final field ARG_FABRIC_ENABLED Ljava/lang/String;
165164
protected static final field ARG_LAUNCH_OPTIONS Ljava/lang/String;
166165
public static final field Companion Lcom/facebook/react/ReactFragment$Companion;
167166
protected field reactDelegate Lcom/facebook/react/ReactDelegate;
@@ -188,12 +187,9 @@ public final class com/facebook/react/ReactFragment$Builder {
188187
public fun <init> ()V
189188
public final fun build ()Lcom/facebook/react/ReactFragment;
190189
public final fun getComponentName ()Ljava/lang/String;
191-
public final fun getFabricEnabled ()Z
192190
public final fun getLaunchOptions ()Landroid/os/Bundle;
193191
public final fun setComponentName (Ljava/lang/String;)Lcom/facebook/react/ReactFragment$Builder;
194192
public final fun setComponentName (Ljava/lang/String;)V
195-
public final fun setFabricEnabled (Z)Lcom/facebook/react/ReactFragment$Builder;
196-
public final fun setFabricEnabled (Z)V
197193
public final fun setLaunchOptions (Landroid/os/Bundle;)Lcom/facebook/react/ReactFragment$Builder;
198194
public final fun setLaunchOptions (Landroid/os/Bundle;)V
199195
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.kt

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity {
3232
super.onCreate(savedInstanceState)
3333
var mainComponentName: String? = null
3434
var launchOptions: Bundle? = null
35-
var fabricEnabled = false
3635
arguments?.let { args ->
3736
mainComponentName = args.getString(ARG_COMPONENT_NAME)
3837
launchOptions = args.getBundle(ARG_LAUNCH_OPTIONS)
39-
fabricEnabled = args.getBoolean(ARG_FABRIC_ENABLED)
4038
@Suppress("DEPRECATION")
4139
disableHostLifecycleEvents = args.getBoolean(ARG_DISABLE_HOST_LIFECYCLE_EVENTS)
4240
}
@@ -52,7 +50,6 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity {
5250
reactNativeHost,
5351
mainComponentName,
5452
launchOptions,
55-
fabricEnabled,
5653
)
5754
}
5855
}
@@ -176,7 +173,6 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity {
176173
public class Builder {
177174
public var componentName: String? = null
178175
public var launchOptions: Bundle? = null
179-
public var fabricEnabled: Boolean = false
180176

181177
/**
182178
* Set the Component name for our React Native instance.
@@ -200,21 +196,12 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity {
200196
return this
201197
}
202198

203-
public fun build(): ReactFragment = newInstance(componentName, launchOptions, fabricEnabled)
204-
205-
@Deprecated(
206-
"You should not change call ReactFragment.setFabricEnabled. Instead enable the NewArchitecture for the whole application with newArchEnabled=true in your gradle.properties file"
207-
)
208-
public fun setFabricEnabled(fabricEnabled: Boolean): Builder {
209-
this.fabricEnabled = fabricEnabled
210-
return this
211-
}
199+
public fun build(): ReactFragment = newInstance(componentName, launchOptions)
212200
}
213201

214202
public companion object {
215203
protected const val ARG_COMPONENT_NAME: String = "arg_component_name"
216204
protected const val ARG_LAUNCH_OPTIONS: String = "arg_launch_options"
217-
protected const val ARG_FABRIC_ENABLED: String = "arg_fabric_enabled"
218205

219206
@Deprecated(
220207
"We will remove this and use a different solution for handling Fragment lifecycle events."
@@ -225,19 +212,16 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity {
225212
/**
226213
* @param componentName The name of the react native component
227214
* @param launchOptions The launch options for the react native component
228-
* @param fabricEnabled Flag to enable Fabric for ReactFragment
229215
* @return A new instance of fragment ReactFragment.
230216
*/
231217
private fun newInstance(
232218
componentName: String?,
233219
launchOptions: Bundle?,
234-
fabricEnabled: Boolean,
235220
): ReactFragment {
236221
val args =
237222
Bundle().apply {
238223
putString(ARG_COMPONENT_NAME, componentName)
239224
putBundle(ARG_LAUNCH_OPTIONS, launchOptions)
240-
putBoolean(ARG_FABRIC_ENABLED, fabricEnabled)
241225
}
242226
return ReactFragment().apply { setArguments(args) }
243227
}

0 commit comments

Comments
 (0)