Files
react-native-svg/common/cpp/react/renderer/components/rnsvg/RNSVGImageComponentDescriptor.h
Wojciech Lewicki 03ca039497 feat: add support for RN 73 (#2181)
PR bumping the library code to compile on new arch on RN 0.73.x and restoring the proper configuration of Image component on new arch on Android.

Also bumping the FabricExample to check if the code works correctly.
2023-12-01 11:58:49 +01:00

45 lines
1.3 KiB
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <react/renderer/imagemanager/ImageManager.h>
#include <react/utils/ContextContainer.h>
#include "RNSVGImageShadowNode.h"
namespace facebook {
namespace react {
/*
* Descriptor for <RNSVGImage> component.
*/
class RNSVGImageComponentDescriptor final
: public ConcreteComponentDescriptor<RNSVGImageShadowNode> {
public:
RNSVGImageComponentDescriptor(ComponentDescriptorParameters const &parameters)
: ConcreteComponentDescriptor(parameters),
imageManager_(std::make_shared<ImageManager>(contextContainer_)){};
void adopt(ShadowNode &shadowNode) const override {
ConcreteComponentDescriptor::adopt(shadowNode);
auto &imageShadowNode = static_cast<RNSVGImageShadowNode &>(shadowNode);
// `RNSVGImageShadowNode` uses `ImageManager` to initiate image loading and
// communicate the loading state and results to mounting layer.
imageShadowNode.setImageManager(imageManager_);
}
private:
const SharedImageManager imageManager_;
};
} // namespace react
} // namespace facebook