mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
5463fc260b
Summary: Quite trivial. Note that std::unordered_map's `operator[]` is not `const`, so we have to use `at` instead. Reviewed By: mdvacca Differential Revision: D7467799 fbshipit-source-id: df38b21dccee4b347f7c070600af0d52f38d6570
27 lines
968 B
C++
27 lines
968 B
C++
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
#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
|