Skip to content

Commit

Permalink
Remove legacy ReactNativeConfig abstraction (facebook#47247)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#47247

Changelog: [internal]

Bye bye `ReactNativeConfig` 👋.

All existing usages of the API have been cleaned up or migrated to `ReactNativeFeatureFlags`, so this is no longer needed.

Reviewed By: GijsWeterings

Differential Revision: D65062306

fbshipit-source-id: 76afcd48ad72023b6dc2a90955ae2f03a1164cca
  • Loading branch information
rubennorte authored and facebook-github-bot committed Dec 10, 2024
1 parent c24f963 commit 6ba8b65
Show file tree
Hide file tree
Showing 53 changed files with 122 additions and 505 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ - (RCTHost *)createReactHost:(NSDictionary *)launchOptions
- (std::shared_ptr<facebook::react::JSRuntimeFactory>)createJSRuntimeFactory
{
#if USE_HERMES
return std::make_shared<facebook::react::RCTHermesInstance>(nullptr, nullptr, /* allocInOldGenBeforeTTI */ false);
return std::make_shared<facebook::react::RCTHermesInstance>(nullptr, /* allocInOldGenBeforeTTI */ false);
#else
return std::make_shared<facebook::react::RCTJscInstance>();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ Pod::Spec.new do |s|
s.dependency "React-RCTNetwork"
s.dependency "React-RCTImage"
s.dependency "React-CoreModules"
s.dependency "React-nativeconfig"
s.dependency "React-RCTFBReactNativeSpec"
s.dependency "React-defaultsnativemodule"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
#import <cxxreact/SystraceSection.h>
#import <react/config/ReactNativeConfig.h>
#import <react/renderer/components/root/RootShadowNode.h>
#import <react/renderer/core/LayoutableShadowNode.h>
#import <react/renderer/core/RawProps.h>
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/React/React-RCTFabric.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ Pod::Spec.new do |s|
"react/renderer/components/textinput/platform/ios",
]);

add_dependency(s, "React-nativeconfig")
add_dependency(s, "React-graphics", :additional_framework_paths => ["react/renderer/graphics/platform/ios"])
add_dependency(s, "React-ImageManager")
add_dependency(s, "React-featureflags")
Expand Down
16 changes: 2 additions & 14 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -2585,10 +2585,6 @@ public class com/facebook/react/fabric/DevToolsReactPerfLogger$FabricCommitPoint
public fun toString ()Ljava/lang/String;
}

public final class com/facebook/react/fabric/EmptyReactNativeConfig : com/facebook/react/fabric/ReactNativeConfig {
public fun <init> ()V
}

public final class com/facebook/react/fabric/FabricSoLoader {
public static final field INSTANCE Lcom/facebook/react/fabric/FabricSoLoader;
public static final fun staticInit ()V
Expand Down Expand Up @@ -2645,7 +2641,7 @@ public class com/facebook/react/fabric/FabricUIManager : com/facebook/react/brid
}

public class com/facebook/react/fabric/FabricUIManagerProviderImpl : com/facebook/react/bridge/UIManagerProvider {
public fun <init> (Lcom/facebook/react/fabric/ComponentFactory;Lcom/facebook/react/fabric/ReactNativeConfig;Lcom/facebook/react/uimanager/ViewManagerRegistry;)V
public fun <init> (Lcom/facebook/react/fabric/ComponentFactory;Lcom/facebook/react/uimanager/ViewManagerRegistry;)V
public fun createUIManager (Lcom/facebook/react/bridge/ReactApplicationContext;)Lcom/facebook/react/bridge/UIManager;
}

Expand All @@ -2656,14 +2652,6 @@ public abstract class com/facebook/react/fabric/GuardedFrameCallback : android/v
protected abstract fun doFrameGuarded (J)V
}

public abstract interface class com/facebook/react/fabric/ReactNativeConfig {
public static final field Companion Lcom/facebook/react/fabric/ReactNativeConfig$Companion;
public static final field DEFAULT_CONFIG Lcom/facebook/react/fabric/ReactNativeConfig;
}

public final class com/facebook/react/fabric/ReactNativeConfig$Companion {
}

public class com/facebook/react/fabric/StateWrapperImpl : com/facebook/jni/HybridClassBase, com/facebook/react/uimanager/StateWrapper {
public fun destroyState ()V
public fun getStateData ()Lcom/facebook/react/bridge/ReadableNativeMap;
Expand Down Expand Up @@ -3841,7 +3829,7 @@ public abstract class com/facebook/react/runtime/cxxreactpackage/CxxReactPackage
public final class com/facebook/react/runtime/hermes/HermesInstance : com/facebook/react/runtime/JSRuntimeFactory {
public static final field Companion Lcom/facebook/react/runtime/hermes/HermesInstance$Companion;
public fun <init> ()V
public fun <init> (Lcom/facebook/react/fabric/ReactNativeConfig;Z)V
public fun <init> (Z)V
}

public final class com/facebook/react/runtime/hermes/HermesInstance$Companion {
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/ReactAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ val preparePrefab by
Pair("../ReactCommon/callinvoker/", ""),
Pair("../ReactCommon/cxxreact/", "cxxreact/"),
Pair("../ReactCommon/react/bridging/", "react/bridging/"),
Pair("../ReactCommon/react/config/", "react/config/"),
Pair("../ReactCommon/react/nativemodule/core/", ""),
Pair("../ReactCommon/react/nativemodule/core/platform/android/", ""),
Pair(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.facebook.react.ReactPackage
import com.facebook.react.ReactPackageTurboModuleManagerDelegate
import com.facebook.react.bridge.JSBundleLoader
import com.facebook.react.common.annotations.UnstableReactNativeAPI
import com.facebook.react.fabric.ReactNativeConfig
import com.facebook.react.runtime.BindingsInstaller
import com.facebook.react.runtime.JSRuntimeFactory
import com.facebook.react.runtime.ReactHostDelegate
Expand All @@ -31,8 +30,6 @@ import com.facebook.react.runtime.hermes.HermesInstance
* @param jsRuntimeFactory Object that holds a native reference to the JS Runtime factory
* @param bindingsInstaller Object that holds a native C++ references that allow host applications
* to install C++ objects into jsi::Runtime during the initialization of React Native
* @param reactNativeConfig ReactNative Configuration that allows to customize the behavior of
* key/value pairs used by the framework to enable/disable experimental capabilities
* @param exceptionHandler Callback that can be used by React Native host applications to react to
* exceptions thrown by the internals of React Native.
*/
Expand All @@ -44,12 +41,8 @@ public class DefaultReactHostDelegate(
override val reactPackages: List<ReactPackage> = emptyList(),
override val jsRuntimeFactory: JSRuntimeFactory = HermesInstance(),
override val bindingsInstaller: BindingsInstaller? = null,
private val reactNativeConfig: ReactNativeConfig = ReactNativeConfig.DEFAULT_CONFIG,
private val exceptionHandler: (Exception) -> Unit = { throw it },
override val turboModuleManagerDelegateBuilder: ReactPackageTurboModuleManagerDelegate.Builder
) : ReactHostDelegate {

override fun getReactNativeConfig(): ReactNativeConfig = reactNativeConfig

override fun handleInstanceException(error: Exception): Unit = exceptionHandler(error)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import com.facebook.react.bridge.UIManagerProvider
import com.facebook.react.common.annotations.UnstableReactNativeAPI
import com.facebook.react.fabric.ComponentFactory
import com.facebook.react.fabric.FabricUIManagerProviderImpl
import com.facebook.react.fabric.ReactNativeConfig
import com.facebook.react.uimanager.ViewManagerRegistry
import com.facebook.react.uimanager.ViewManagerResolver

Expand Down Expand Up @@ -63,8 +62,7 @@ protected constructor(
reactInstanceManager.getOrCreateViewManagers(reactApplicationContext))
}

FabricUIManagerProviderImpl(
componentFactory, ReactNativeConfig.DEFAULT_CONFIG, viewManagerRegistry)
FabricUIManagerProviderImpl(componentFactory, viewManagerRegistry)
.createUIManager(reactApplicationContext)
}
} else {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ internal class FabricUIManagerBinding : HybridClassBase() {
uiManager: FabricUIManager,
eventBeatManager: EventBeatManager,
componentsRegistry: ComponentFactory,
reactNativeConfig: Any
)

public external fun startSurface(surfaceId: Int, moduleName: String, initialProps: NativeMap)
Expand Down Expand Up @@ -93,16 +92,10 @@ internal class FabricUIManagerBinding : HybridClassBase() {
fabricUIManager: FabricUIManager,
eventBeatManager: EventBeatManager,
componentFactory: ComponentFactory,
reactNativeConfig: ReactNativeConfig
) {
fabricUIManager.setBinding(this)
installFabricUIManager(
runtimeExecutor,
runtimeScheduler,
fabricUIManager,
eventBeatManager,
componentFactory,
reactNativeConfig)
runtimeExecutor, runtimeScheduler, fabricUIManager, eventBeatManager, componentFactory)
setPixelDensity(getDisplayMetricDensity())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@
public class FabricUIManagerProviderImpl implements UIManagerProvider {

private final ComponentFactory mComponentFactory;
private final ReactNativeConfig mConfig;
private final ViewManagerRegistry mViewManagerRegistry;

public FabricUIManagerProviderImpl(
ComponentFactory componentFactory,
ReactNativeConfig config,
ViewManagerRegistry viewManagerRegistry) {
ComponentFactory componentFactory, ViewManagerRegistry viewManagerRegistry) {
mComponentFactory = componentFactory;
mConfig = config;
mViewManagerRegistry = viewManagerRegistry;
}

Expand All @@ -56,12 +52,7 @@ public UIManager createUIManager(ReactApplicationContext reactApplicationContext

if (runtimeExecutor != null && runtimeScheduler != null) {
binding.register(
runtimeExecutor,
runtimeScheduler,
fabricUIManager,
eventBeatManager,
mComponentFactory,
mConfig);
runtimeExecutor, runtimeScheduler, fabricUIManager, eventBeatManager, mComponentFactory);
} else {
throw new IllegalStateException(
"Unable to register FabricUIManager with CatalystInstance, runtimeExecutor and"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.facebook.react.ReactPackage
import com.facebook.react.ReactPackageTurboModuleManagerDelegate
import com.facebook.react.bridge.JSBundleLoader
import com.facebook.react.common.annotations.UnstableReactNativeAPI
import com.facebook.react.fabric.ReactNativeConfig

/**
* [ReactHostDelegate] is an interface that defines parameters required to initialize React Native.
Expand Down Expand Up @@ -54,13 +53,4 @@ public interface ReactHostDelegate {
* the internals of React Native.
*/
public fun handleInstanceException(error: Exception)

/**
* ReactNative Configuration that allows to customize the behavior of key/value pairs used by the
* framework to enable/disable experimental capabilities
*
* [moduleProvider] is a function that returns the Native Module with the name received as a
* parameter.
*/
public fun getReactNativeConfig(): ReactNativeConfig
}
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ final class ReactInstance {
getRuntimeScheduler(),
mFabricUIManager,
eventBeatManager,
componentFactory,
delegate.getReactNativeConfig());
componentFactory);

// Initialize the FabricUIManager
mFabricUIManager.initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,18 @@ package com.facebook.react.runtime.hermes

import com.facebook.jni.HybridData
import com.facebook.jni.annotations.DoNotStrip
import com.facebook.react.fabric.ReactNativeConfig
import com.facebook.react.runtime.JSRuntimeFactory
import com.facebook.soloader.SoLoader

public class HermesInstance(
reactNativeConfig: ReactNativeConfig?,
allocInOldGenBeforeTTI: Boolean
) : JSRuntimeFactory(initHybrid(reactNativeConfig as Any?, allocInOldGenBeforeTTI)) {
public class HermesInstance(allocInOldGenBeforeTTI: Boolean) :
JSRuntimeFactory(initHybrid(allocInOldGenBeforeTTI)) {

public constructor() : this(null, false)
public constructor() : this(false)

public companion object {
@JvmStatic
@DoNotStrip
protected external fun initHybrid(
reactNativeConfig: Any?,
allocInOldGenBeforeTTI: Boolean
): HybridData
protected external fun initHybrid(allocInOldGenBeforeTTI: Boolean): HybridData

init {
SoLoader.loadLibrary("hermesinstancejni")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ add_react_common_subdir(hermes/executor)
add_react_common_subdir(hermes/inspector-modern)
add_react_common_subdir(react/renderer/runtimescheduler)
add_react_common_subdir(react/debug)
add_react_common_subdir(react/config)
add_react_common_subdir(react/featureflags)
add_react_common_subdir(react/performance/timeline)
add_react_common_subdir(react/renderer/animations)
Expand Down Expand Up @@ -168,7 +167,6 @@ add_library(reactnative
$<TARGET_OBJECTS:mapbufferjni>
$<TARGET_OBJECTS:react_bridging>
$<TARGET_OBJECTS:react_codegen_rncore>
$<TARGET_OBJECTS:react_config>
$<TARGET_OBJECTS:react_cxxreact>
$<TARGET_OBJECTS:react_debug>
$<TARGET_OBJECTS:react_devsupportjni>
Expand Down Expand Up @@ -252,7 +250,6 @@ target_include_directories(reactnative
$<TARGET_PROPERTY:mapbufferjni,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_bridging,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_codegen_rncore,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_config,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_cxxreact,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_debug,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_devsupportjni,INTERFACE_INCLUDE_DIRECTORIES>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ target_link_libraries(
react_render_uimanager_consistency
rrc_legacyviewmanagerinterop
react_utils
react_config
reactnativejni
rrc_image
rrc_modal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
namespace facebook::react {

FabricMountingManager::FabricMountingManager(
std::shared_ptr<const ReactNativeConfig>& config,
jni::global_ref<JFabricUIManager::javaobject>& javaUIManager)
: javaUIManager_(javaUIManager) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
namespace facebook::react {

class MountingTransaction;
class ReactNativeConfig;
struct ShadowView;

class FabricMountingManager final {
public:
FabricMountingManager(
std::shared_ptr<const ReactNativeConfig>& config,
jni::global_ref<JFabricUIManager::javaobject>& javaUIManager);
FabricMountingManager(const FabricMountingManager&) = delete;

Expand Down
Loading

0 comments on commit 6ba8b65

Please sign in to comment.