mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary:
# Problem:
I enabled Fabric for "Profile About", when I navigate to "Marketplace Home" from "Profile About", I get following warning "<Component> is not Fabric compatible yet". Even though the component has been migrated to Fabric and is getting registered. The component works if I navigate straight to "Marketplace Home".
{F172219008}
# How it was solved:
It turns out, there was a missing call that added newly created registry to `componentDescriptorRegistries_`.
Reviewed By: shergin
Differential Revision: D16542109
fbshipit-source-id: 22a315333cfff0895ce77e8439816f4e7bf34d35
62 lines
1.6 KiB
C++
62 lines
1.6 KiB
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 "ComponentDescriptorProviderRegistry.h"
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
void ComponentDescriptorProviderRegistry::add(
|
|
ComponentDescriptorProvider provider) const {
|
|
std::unique_lock<better::shared_mutex> lock(mutex_);
|
|
componentDescriptorProviders_.insert({provider.handle, provider});
|
|
|
|
for (auto const &weakRegistry : componentDescriptorRegistries_) {
|
|
auto registry = weakRegistry.lock();
|
|
if (!registry) {
|
|
continue;
|
|
}
|
|
|
|
registry->add(provider);
|
|
}
|
|
}
|
|
|
|
void ComponentDescriptorProviderRegistry::remove(
|
|
ComponentDescriptorProvider provider) const {
|
|
std::unique_lock<better::shared_mutex> lock(mutex_);
|
|
componentDescriptorProviders_.erase(provider.handle);
|
|
|
|
for (auto const &weakRegistry : componentDescriptorRegistries_) {
|
|
auto registry = weakRegistry.lock();
|
|
if (!registry) {
|
|
continue;
|
|
}
|
|
|
|
registry->remove(provider);
|
|
}
|
|
}
|
|
|
|
ComponentDescriptorRegistry::Shared
|
|
ComponentDescriptorProviderRegistry::createComponentDescriptorRegistry(
|
|
ComponentDescriptorParameters const ¶meters) const {
|
|
std::shared_lock<better::shared_mutex> lock(mutex_);
|
|
|
|
auto registry =
|
|
std::make_shared<ComponentDescriptorRegistry const>(parameters);
|
|
|
|
for (auto const &pair : componentDescriptorProviders_) {
|
|
registry->add(pair.second);
|
|
}
|
|
|
|
componentDescriptorRegistries_.push_back(registry);
|
|
|
|
return registry;
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|