mirror of
https://github.com/status-im/react-native.git
synced 2025-01-17 21:11:45 +00:00
da7873563b
Reviewed By: fkgozali Differential Revision: D8065619 fbshipit-source-id: 719c303b40c96950bab8e5dde9a75f449b2956c6
30 lines
1.1 KiB
C++
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
|