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:
Valentin Shergin 2020-04-11 12:12:58 -07:00 коммит произвёл Facebook GitHub Bot
Родитель be78673755
Коммит d7d585f587
3 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak) id<RCTMountingManagerDelegate> delegate;
@property (nonatomic, strong) RCTComponentViewRegistry *componentViewRegistry;
@property (atomic, assign) BOOL useModernDifferentiatorMode;
/**
* Schedule a mounting transaction to be performed on the main thread.
* Can be called from any thread.

Просмотреть файл

@ -266,7 +266,10 @@ static void RNPerformMountInstructions(
SystraceSection s("-[RCTMountingManager performTransaction:]");
RCTAssertMainQueue();
auto transaction = mountingCoordinator->pullTransaction(DifferentiatorMode::Classic);
auto differentiatorMode =
self.useModernDifferentiatorMode ? DifferentiatorMode::OptimizedMoves : DifferentiatorMode::Classic;
auto transaction = mountingCoordinator->pullTransaction(differentiatorMode);
if (!transaction.has_value()) {
return;
}

Просмотреть файл

@ -24,6 +24,7 @@
#import <React/RCTUtils.h>
#import <react/components/root/RootShadowNode.h>
#import <react/config/ReactNativeConfig.h>
#import <react/core/LayoutConstraints.h>
#import <react/core/LayoutContext.h>
#import <react/uimanager/ComponentDescriptorFactory.h>
@ -299,6 +300,12 @@ static inline LayoutContext RCTGetLayoutContext()
RCTScheduler *scheduler = [[RCTScheduler alloc] initWithToolbox:toolbox];
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;
}