react-native/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp
Héctor Ramos da7873563b Migrate Android sources to MIT license header
Reviewed By: fkgozali

Differential Revision: D8065619

fbshipit-source-id: 719c303b40c96950bab8e5dde9a75f449b2956c6
2018-05-31 15:37:30 -07:00

30 lines
1.1 KiB
C++

// Copyright (c) 2004-present, Facebook, Inc.
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
#include "ComponentDescriptorRegistry.h"
namespace facebook {
namespace react {
void ComponentDescriptorRegistry::registerComponentDescriptor(SharedComponentDescriptor componentDescriptor) {
ComponentHandle componentHandle = componentDescriptor->getComponentHandle();
_registryByHandle[componentHandle] = componentDescriptor;
ComponentName componentName = componentDescriptor->getComponentName();
_registryByName[componentName] = componentDescriptor;
}
const SharedComponentDescriptor ComponentDescriptorRegistry::operator[](const SharedShadowNode &shadowNode) const {
ComponentHandle componentHandle = shadowNode->getComponentHandle();
return _registryByHandle.at(componentHandle);
}
const SharedComponentDescriptor ComponentDescriptorRegistry::operator[](const ComponentName &componentName) const {
return _registryByName.at(componentName);
}
} // namespace react
} // namespace facebook