Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/react-native/React/Base/RCTBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ BOOL RCTTurboModuleInteropEnabled(void);
void RCTEnableTurboModuleInterop(BOOL enabled);
#endif // RCT_REMOVE_LEGACY_MODULE_INTEROP

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP
// Turn on the fabric interop layer
BOOL RCTFabricInteropLayerEnabled(void);
void RCTEnableFabricInteropLayer(BOOL enabled);
#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP

BOOL RCTUIManagerDispatchAccessibilityManagerInitOntoMain(void);
void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled);
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/React/Base/RCTBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ void RCTEnableTurboModuleInterop(BOOL enabled)
}
#endif // RCT_REMOVE_LEGACY_MODULE_INTEROP

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP
static BOOL fabricInteropLayerEnabled = YES;
BOOL RCTFabricInteropLayerEnabled()
{
Expand All @@ -221,6 +222,7 @@ void RCTEnableFabricInteropLayer(BOOL enabled)
{
fabricInteropLayerEnabled = enabled;
}
#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP

static RCTBridgeProxyLoggingLevel bridgeProxyLoggingLevel = kRCTBridgeProxyLoggingLevelNone;
RCTBridgeProxyLoggingLevel RCTTurboModuleInteropBridgeProxyLogLevel(void)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP

#import <UIKit/UIKit.h>

#import <React/RCTViewComponentView.h>
Expand All @@ -30,3 +32,5 @@ NS_ASSUME_NONNULL_BEGIN
@end

NS_ASSUME_NONNULL_END

#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#import "RCTLegacyViewManagerInteropComponentView.h"

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP

#import <React/RCTAssert.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTConstants.h>
Expand Down Expand Up @@ -299,3 +301,5 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
}

@end

#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP

#import <Foundation/Foundation.h>
#import <react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h>

Expand All @@ -25,3 +27,5 @@ NS_ASSUME_NONNULL_BEGIN
@end

NS_ASSUME_NONNULL_END

#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/

#import "RCTLegacyViewManagerInteropCoordinatorAdapter.h"

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP

#import <React/UIView+React.h>
#import <react/utils/FollyConvert.h>

Expand Down Expand Up @@ -146,3 +149,5 @@ - (BOOL)_propIsSameObject:(id)first second:(id)second
}

@end

#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
#import <React/RCTComponentViewClassDescriptor.h>
#import <React/RCTFabricComponentsPlugins.h>
#import <React/RCTImageComponentView.h>
#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP
#import <React/RCTLegacyViewManagerInteropComponentView.h>
#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP
#import <React/RCTMountingTransactionObserving.h>
#import <React/RCTParagraphComponentView.h>
#import <React/RCTRootComponentView.h>
Expand Down Expand Up @@ -125,11 +127,6 @@ - (void)_registerComponentIfPossible:(const std::string &)name
return;
}

// Paper name: we prepare this variables to warn the user
// when the component is registered in both Fabric and in the
// interop layer, so they can remove that
NSString *componentNameString = RCTNSStringFromString(name);

// Fallback 1: Call provider function for component view class.
Class<RCTComponentViewProtocol> klass = RCTComponentViewClassWithName(name.c_str());
if (klass != nullptr) {
Expand All @@ -149,6 +146,12 @@ - (void)_registerComponentIfPossible:(const std::string &)name
}
}

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP
// Paper name: we prepare this variables to warn the user
// when the component is registered in both Fabric and in the
// interop layer, so they can remove that
NSString *componentNameString = RCTNSStringFromString(name);

// Fallback 3: Try to use Paper Interop.
// TODO(T174674274): Implement lazy loading of legacy view managers in the new architecture.
if (RCTFabricInteropLayerEnabled() && [RCTLegacyViewManagerInteropComponentView isSupported:componentNameString]) {
Expand All @@ -166,6 +169,7 @@ - (void)_registerComponentIfPossible:(const std::string &)name
_registrationStatusMap.insert({provider.name, true});
return;
}
#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP

// Fallback 4: use <UnimplementedView> if component doesn't exist.
auto flavor = std::make_shared<const std::string>(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ - (Class)_getModuleClassFromName:(const char *)moduleName
return moduleClass;
}

#ifndef RCT_REMOVE_LEGACY_MODULE_INTEROP
// fallback on modules registered throught RCT_EXPORT_MODULE with custom names
NSString *objcModuleName = [NSString stringWithUTF8String:moduleName];
NSArray<Class> *modules = RCTGetModuleClasses();
Expand All @@ -767,6 +768,7 @@ - (Class)_getModuleClassFromName:(const char *)moduleName
return current;
}
}
#endif

return moduleClass;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/

#include "LegacyViewManagerInteropComponentDescriptor.h"

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP

#include <React/RCTBridge+Private.h>
#include <React/RCTBridge.h>
#include <React/RCTBridgeModuleDecorator.h>
Expand Down Expand Up @@ -175,3 +178,5 @@ static Class getViewManagerClass(const std::string &componentName, RCTBridge *br
legacyViewManagerInteropShadowNode.setStateData(std::move(state));
}
} // namespace facebook::react

#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP

#import <Foundation/Foundation.h>
#import <React/RCTBridgeModuleDecorator.h>
#import <UIKit/UIKit.h>
Expand Down Expand Up @@ -42,3 +44,5 @@ typedef void (^InterceptorBlock)(std::string eventName, folly::dynamic &&event);
@end

NS_ASSUME_NONNULL_END

#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/

#include "RCTLegacyViewManagerInteropCoordinator.h"

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP

#include <React/RCTBridge+Private.h>
#include <React/RCTBridgeMethod.h>
#include <React/RCTBridgeProxy.h>
Expand Down Expand Up @@ -220,3 +223,5 @@ - (void)_lookupModuleMethodsIfNecessary
}

@end

#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@

#import "ObjCTimerRegistry.h"
#import "RCTJSThreadManager.h"
#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP
#import "RCTLegacyUIManagerConstantsProvider.h"
#endif
#import "RCTPerformanceLoggerUtils.h"

#if RCT_DEV_MENU && __has_include(<React/RCTDevLoadingViewProtocol.h>)
Expand Down Expand Up @@ -447,9 +449,11 @@ - (void)_start
});
RCTInstallNativeComponentRegistryBinding(runtime);

#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP
if (ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode()) {
installLegacyUIManagerConstantsProviderBinding(runtime);
}
#endif

[strongSelf->_delegate instance:strongSelf didInitializeRuntime:runtime];

Expand Down
Loading