mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Back out "Update useNativeViewConfigsInBridgelessMode" (#43883)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43883 Changelog: [Internal] Backing out original diff `D55705805` to fix CircleCI Dynamic library test failure Reviewed By: philIip Differential Revision: D55773581 fbshipit-source-id: 2ec1b82241389166c1c31c979106c4ee6ead83fe
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b5db214d2a
commit
d2a8222bc6
@@ -298,7 +298,6 @@
|
||||
|
||||
class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
|
||||
public:
|
||||
RCTAppDelegateBridgelessFeatureFlags(bool fabricEnabled) : _fabricEnabled(fabricEnabled) {}
|
||||
bool useModernRuntimeScheduler() override
|
||||
{
|
||||
return true;
|
||||
@@ -311,20 +310,12 @@ class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNative
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool useNativeViewConfigsInBridgelessMode() override
|
||||
{
|
||||
return _fabricEnabled;
|
||||
}
|
||||
|
||||
private:
|
||||
bool _fabricEnabled;
|
||||
};
|
||||
|
||||
- (void)_setUpFeatureFlags
|
||||
{
|
||||
if ([self bridgelessEnabled]) {
|
||||
facebook::react::ReactNativeFeatureFlags::override(
|
||||
std::make_unique<RCTAppDelegateBridgelessFeatureFlags>(self.fabricEnabled));
|
||||
facebook::react::ReactNativeFeatureFlags::override(std::make_unique<RCTAppDelegateBridgelessFeatureFlags>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,9 +113,12 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
|
||||
initialProperties:(NSDictionary *)initialProperties
|
||||
launchOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
NSDictionary *initProps = updateInitialProps(initialProperties, _configuration.fabricEnabled);
|
||||
NSDictionary *initProps = updateInitialProps(initialProperties, self->_configuration.fabricEnabled);
|
||||
|
||||
if (self->_configuration.bridgelessEnabled) {
|
||||
// Enable native view config interop only if both bridgeless mode and Fabric is enabled.
|
||||
RCTSetUseNativeViewConfigsInBridgelessMode(self->_configuration.fabricEnabled);
|
||||
|
||||
if (_configuration.bridgelessEnabled) {
|
||||
// Enable TurboModule interop by default in Bridgeless mode
|
||||
RCTEnableTurboModuleInterop(YES);
|
||||
RCTEnableTurboModuleInteropBridgeProxy(YES);
|
||||
@@ -135,8 +138,8 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
|
||||
[self createBridgeIfNeeded:launchOptions];
|
||||
[self createBridgeAdapterIfNeeded];
|
||||
|
||||
if (_configuration.createRootViewWithBridge != nil) {
|
||||
return _configuration.createRootViewWithBridge(self.bridge, moduleName, initProps);
|
||||
if (self->_configuration.createRootViewWithBridge != nil) {
|
||||
return self->_configuration.createRootViewWithBridge(self.bridge, moduleName, initProps);
|
||||
}
|
||||
|
||||
return [self createRootViewWithBridge:self.bridge moduleName:moduleName initProps:initProps];
|
||||
|
||||
@@ -51,3 +51,18 @@ void RCTSetMemoryPressureUnloadLevel(int value)
|
||||
{
|
||||
RCTMemoryPressureUnloadLevel = value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use native view configs in bridgeless mode
|
||||
*/
|
||||
static BOOL RCTUseNativeViewConfigsInBridgelessMode = NO;
|
||||
|
||||
BOOL RCTGetUseNativeViewConfigsInBridgelessMode(void)
|
||||
{
|
||||
return RCTUseNativeViewConfigsInBridgelessMode;
|
||||
}
|
||||
|
||||
void RCTSetUseNativeViewConfigsInBridgelessMode(BOOL value)
|
||||
{
|
||||
RCTUseNativeViewConfigsInBridgelessMode = value;
|
||||
}
|
||||
|
||||
+3
-4
@@ -9,7 +9,6 @@
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <React/RCTSurfacePresenterStub.h>
|
||||
#import <react/featureflags/ReactNativeFeatureFlags.h>
|
||||
|
||||
#import "RCTAssert.h"
|
||||
#import "RCTBridge+Private.h"
|
||||
@@ -1151,10 +1150,10 @@ RCT_EXPORT_METHOD(dispatchViewManagerCommand
|
||||
return;
|
||||
}
|
||||
|
||||
__weak __typeof(self) weakSelf = self;
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
void (^mountingBlock)(void) = ^{
|
||||
__typeof(self) strongSelf = weakSelf;
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
|
||||
@try {
|
||||
for (RCTViewManagerUIBlock block in previousPendingUIBlocks) {
|
||||
@@ -1453,7 +1452,7 @@ NSMutableDictionary<NSString *, id> *RCTModuleConstantsForDestructuredComponent(
|
||||
// lazifyViewManagerConfig function in JS. This fuction uses NativeModules global object that is not available in the
|
||||
// New Architecture. To make native view configs work in the New Architecture we will populate these properties in
|
||||
// native.
|
||||
if (facebook::react::ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode()) {
|
||||
if (RCTGetUseNativeViewConfigsInBridgelessMode()) {
|
||||
moduleConstants[@"Commands"] = viewConfig[@"Commands"];
|
||||
moduleConstants[@"Constants"] = viewConfig[@"Constants"];
|
||||
}
|
||||
+4
-5
@@ -8,7 +8,6 @@
|
||||
#import "RCTComponentData.h"
|
||||
|
||||
#import <objc/message.h>
|
||||
#import <react/featureflags/ReactNativeFeatureFlags.h>
|
||||
|
||||
#import "RCTBridge.h"
|
||||
#import "RCTBridgeModule.h"
|
||||
@@ -281,9 +280,9 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
case _value: { \
|
||||
__block BOOL setDefaultValue = NO; \
|
||||
__block _type defaultValue; \
|
||||
_type (*convert)(id, SEL, id) = (__typeof(convert))objc_msgSend; \
|
||||
_type (*get)(id, SEL) = (__typeof(get))objc_msgSend; \
|
||||
void (*set)(id, SEL, _type) = (__typeof(set))objc_msgSend; \
|
||||
_type (*convert)(id, SEL, id) = (typeof(convert))objc_msgSend; \
|
||||
_type (*get)(id, SEL) = (typeof(get))objc_msgSend; \
|
||||
void (*set)(id, SEL, _type) = (typeof(set))objc_msgSend; \
|
||||
setterBlock = ^(id target, id json) { \
|
||||
if (json) { \
|
||||
if (!setDefaultValue && target) { \
|
||||
@@ -502,7 +501,7 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
@"baseModuleName" : superClass == [NSObject class] ? (id)kCFNull : RCTViewManagerModuleNameForClass(superClass),
|
||||
}];
|
||||
|
||||
if (facebook::react::ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode()) {
|
||||
if (RCTGetUseNativeViewConfigsInBridgelessMode()) {
|
||||
result[@"Commands"] = [self commandsForViewMangerClass:managerClass methods:methods methodCount:count];
|
||||
result[@"Constants"] = [self constantsForViewMangerClass:managerClass];
|
||||
}
|
||||
+1
-2
@@ -38,7 +38,6 @@
|
||||
#import <cxxreact/ReactMarker.h>
|
||||
#import <jsinspector-modern/ReactCdp.h>
|
||||
#import <jsireact/JSIExecutor.h>
|
||||
#import <react/featureflags/ReactNativeFeatureFlags.h>
|
||||
#import <react/runtime/BridgelessJSCallInvoker.h>
|
||||
#import <react/utils/ContextContainer.h>
|
||||
#import <react/utils/ManagedObjectWrapper.h>
|
||||
@@ -350,7 +349,7 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
|
||||
});
|
||||
RCTInstallNativeComponentRegistryBinding(runtime);
|
||||
|
||||
if (ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode()) {
|
||||
if (RCTGetUseNativeViewConfigsInBridgelessMode()) {
|
||||
installLegacyUIManagerConstantsProviderBinding(runtime);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user