react-native/ReactCommon/fabric/sample/SampleComponentDescriptorFactor.cpp
David Vacca b421b5f4bd Open source Fabric android
Summary: This diff open sources Fabric Android implementation and it extracts ComponentDescriptorFactory into a function that can be "injected" per application

Reviewed By: shergin

Differential Revision: D13616172

fbshipit-source-id: 7b7a6461216740b5a1ad5ebbead9e37de4570221
2019-01-16 12:38:22 -08:00

28 lines
793 B
C++

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <react/uimanager/ComponentDescriptorFactory.h>
#include <react/uimanager/ComponentDescriptorRegistry.h>
#include <react/uimanager/ContextContainer.h>
namespace facebook {
namespace react {
/**
* This is a sample implementation. Each app should provide its own.
*/
ComponentRegistryFactory getDefaultComponentRegistryFactory() {
return [](const SharedEventDispatcher &eventDispatcher,
const SharedContextContainer &contextContainer) {
auto registry = std::make_shared<ComponentDescriptorRegistry>();
return registry;
}
}
} // namespace react
} // namespace facebook