Fabric: Using ComponentDescriptorProviderRegistry in UITemplateProcessorTest

Summary:
ComponentDescriptorProviderRegistry is a new API for component registration.

Changelog: [Internal] Fabric-specific change in UIManager test.

Reviewed By: mdvacca

Differential Revision: D18010489

fbshipit-source-id: d615bfb5c9437da7358c0bd8465ab4b6525089e6
This commit is contained in:
Valentin Shergin 2019-10-20 20:51:09 -07:00 коммит произвёл Facebook Github Bot
Родитель 8a8ff63b7d
Коммит c8176881ce
1 изменённых файлов: 10 добавлений и 9 удалений

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

@ -19,6 +19,7 @@ using namespace facebook::react;
#include <react/components/view/ViewComponentDescriptor.h>
#include <react/config/ReactNativeConfig.h>
#include <react/uimanager/ComponentDescriptorFactory.h>
#include <react/uimanager/ComponentDescriptorProviderRegistry.h>
#include <react/uimanager/ComponentDescriptorRegistry.h>
#include <react/utils/ContextContainer.h>
@ -28,15 +29,15 @@ namespace react {
static ComponentRegistryFactory getComponentRegistryFactory() {
return [](const EventDispatcher::Weak &eventDispatcher,
const ContextContainer::Shared &contextContainer) {
auto registry = std::make_shared<ComponentDescriptorRegistry>();
registry->registerComponentDescriptor(
std::make_shared<ViewComponentDescriptor>(eventDispatcher));
registry->registerComponentDescriptor(
std::make_shared<ScrollViewComponentDescriptor>(eventDispatcher));
registry->registerComponentDescriptor(
std::make_shared<ActivityIndicatorViewComponentDescriptor>(
eventDispatcher));
return registry;
ComponentDescriptorProviderRegistry providerRegistry{};
providerRegistry.add(
concreteComponentDescriptorProvider<ViewComponentDescriptor>());
providerRegistry.add(
concreteComponentDescriptorProvider<ScrollViewComponentDescriptor>());
providerRegistry.add(concreteComponentDescriptorProvider<
ActivityIndicatorViewComponentDescriptor>());
return providerRegistry.createComponentDescriptorRegistry(
{eventDispatcher, contextContainer});
};
}