Fabric: Controlling DifferentiatorMode via ReactNativeConfig
Summary: Now we can control the differentiator mode via MC. Changelog: [Internal] Fabric-specific internal change. Reviewed By: fkgozali Differential Revision: D20978857 fbshipit-source-id: 13264948762f02f874d8d051c873d378062d6db4
This commit is contained in:
Родитель
be78673755
Коммит
d7d585f587
|
@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
@property (nonatomic, weak) id<RCTMountingManagerDelegate> delegate;
|
@property (nonatomic, weak) id<RCTMountingManagerDelegate> delegate;
|
||||||
@property (nonatomic, strong) RCTComponentViewRegistry *componentViewRegistry;
|
@property (nonatomic, strong) RCTComponentViewRegistry *componentViewRegistry;
|
||||||
|
|
||||||
|
@property (atomic, assign) BOOL useModernDifferentiatorMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule a mounting transaction to be performed on the main thread.
|
* Schedule a mounting transaction to be performed on the main thread.
|
||||||
* Can be called from any thread.
|
* Can be called from any thread.
|
||||||
|
|
|
@ -266,7 +266,10 @@ static void RNPerformMountInstructions(
|
||||||
SystraceSection s("-[RCTMountingManager performTransaction:]");
|
SystraceSection s("-[RCTMountingManager performTransaction:]");
|
||||||
RCTAssertMainQueue();
|
RCTAssertMainQueue();
|
||||||
|
|
||||||
auto transaction = mountingCoordinator->pullTransaction(DifferentiatorMode::Classic);
|
auto differentiatorMode =
|
||||||
|
self.useModernDifferentiatorMode ? DifferentiatorMode::OptimizedMoves : DifferentiatorMode::Classic;
|
||||||
|
|
||||||
|
auto transaction = mountingCoordinator->pullTransaction(differentiatorMode);
|
||||||
if (!transaction.has_value()) {
|
if (!transaction.has_value()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#import <React/RCTUtils.h>
|
#import <React/RCTUtils.h>
|
||||||
|
|
||||||
#import <react/components/root/RootShadowNode.h>
|
#import <react/components/root/RootShadowNode.h>
|
||||||
|
#import <react/config/ReactNativeConfig.h>
|
||||||
#import <react/core/LayoutConstraints.h>
|
#import <react/core/LayoutConstraints.h>
|
||||||
#import <react/core/LayoutContext.h>
|
#import <react/core/LayoutContext.h>
|
||||||
#import <react/uimanager/ComponentDescriptorFactory.h>
|
#import <react/uimanager/ComponentDescriptorFactory.h>
|
||||||
|
@ -299,6 +300,12 @@ static inline LayoutContext RCTGetLayoutContext()
|
||||||
RCTScheduler *scheduler = [[RCTScheduler alloc] initWithToolbox:toolbox];
|
RCTScheduler *scheduler = [[RCTScheduler alloc] initWithToolbox:toolbox];
|
||||||
scheduler.delegate = self;
|
scheduler.delegate = self;
|
||||||
|
|
||||||
|
auto reactNativeConfig = _contextContainer->at<std::shared_ptr<ReactNativeConfig const>>("ReactNativeConfig");
|
||||||
|
if (reactNativeConfig) {
|
||||||
|
_mountingManager.useModernDifferentiatorMode =
|
||||||
|
reactNativeConfig->getBool("react_fabric:enabled_optimized_moves_differ_ios");
|
||||||
|
}
|
||||||
|
|
||||||
return scheduler;
|
return scheduler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче