mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: # LegacyViewManagerInterop is born LegacyViewManagerInterop is a component that should make it possible for legacy components to work in Fabric, new renderer. This is just a first stage that prints keys of props to screen together with component name. Reviewed By: shergin Differential Revision: D17552827 fbshipit-source-id: c3e062f413727729e6a9b683c60f59f0292cc63b
42 lines
1.3 KiB
C++
42 lines
1.3 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 "LegacyViewManagerInteropComponentDescriptor.h"
|
|
#include "LegacyViewManagerInteropState.h"
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
ComponentHandle
|
|
LegacyViewManagerInteropComponentDescriptor::getComponentHandle() const {
|
|
return reinterpret_cast<ComponentHandle>(getComponentName());
|
|
}
|
|
|
|
ComponentName LegacyViewManagerInteropComponentDescriptor::getComponentName()
|
|
const {
|
|
return std::static_pointer_cast<std::string const>(this->flavor_)->c_str();
|
|
}
|
|
|
|
void LegacyViewManagerInteropComponentDescriptor::adopt(
|
|
ShadowNode::Unshared shadowNode) const {
|
|
ConcreteComponentDescriptor::adopt(shadowNode);
|
|
|
|
assert(std::dynamic_pointer_cast<LegacyViewManagerInteropShadowNode>(
|
|
shadowNode));
|
|
auto legacyViewManagerInteropShadowNode =
|
|
std::static_pointer_cast<LegacyViewManagerInteropShadowNode>(shadowNode);
|
|
|
|
// Storing a component name inside the ShadowNode.
|
|
auto state = LegacyViewManagerInteropState{};
|
|
state.componentName =
|
|
*std::static_pointer_cast<std::string const>(this->flavor_);
|
|
|
|
legacyViewManagerInteropShadowNode->setStateData(std::move(state));
|
|
}
|
|
} // namespace react
|
|
} // namespace facebook
|