File tree Expand file tree Collapse file tree 2 files changed +33
-15
lines changed
packages/react-native/ReactCommon/react/renderer/components/image Expand file tree Collapse file tree 2 files changed +33
-15
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #include " ImageComponentDescriptor.h"
9
+ #include < react/renderer/imagemanager/ImageManager.h>
10
+
11
+ namespace facebook ::react {
12
+
13
+ ImageComponentDescriptor::ImageComponentDescriptor (
14
+ const ComponentDescriptorParameters& parameters)
15
+ : ConcreteComponentDescriptor(parameters),
16
+ imageManager_ (std::make_shared<ImageManager>(contextContainer_)){};
17
+
18
+ void ImageComponentDescriptor::adopt (ShadowNode& shadowNode) const {
19
+ ConcreteComponentDescriptor::adopt (shadowNode);
20
+
21
+ auto & imageShadowNode = static_cast <ImageShadowNode&>(shadowNode);
22
+
23
+ // `ImageShadowNode` uses `ImageManager` to initiate image loading and
24
+ // communicate the loading state and results to mounting layer.
25
+ imageShadowNode.setImageManager (imageManager_);
26
+ }
27
+ } // namespace facebook::react
Original file line number Diff line number Diff line change 9
9
10
10
#include < react/renderer/components/image/ImageShadowNode.h>
11
11
#include < react/renderer/core/ConcreteComponentDescriptor.h>
12
- #include < react/renderer/imagemanager/ImageManager.h>
13
- #include < react/utils/ContextContainer.h>
14
12
15
13
namespace facebook ::react {
16
14
15
+ class ImageManager ;
16
+
17
17
/*
18
18
* Descriptor for <Image> component.
19
19
*/
20
20
class ImageComponentDescriptor final
21
21
: public ConcreteComponentDescriptor<ImageShadowNode> {
22
22
public:
23
- ImageComponentDescriptor (const ComponentDescriptorParameters& parameters)
24
- : ConcreteComponentDescriptor(parameters),
25
- imageManager_ (std::make_shared<ImageManager>(contextContainer_)){};
26
-
27
- void adopt (ShadowNode& shadowNode) const override {
28
- ConcreteComponentDescriptor::adopt (shadowNode);
29
-
30
- auto & imageShadowNode = static_cast <ImageShadowNode&>(shadowNode);
23
+ explicit ImageComponentDescriptor (
24
+ const ComponentDescriptorParameters& parameters);
31
25
32
- // `ImageShadowNode` uses `ImageManager` to initiate image loading and
33
- // communicate the loading state and results to mounting layer.
34
- imageShadowNode.setImageManager (imageManager_);
35
- }
26
+ void adopt (ShadowNode& shadowNode) const override ;
36
27
37
28
private:
38
- const SharedImageManager imageManager_;
29
+ const std::shared_ptr<ImageManager> imageManager_;
39
30
};
40
31
41
32
} // namespace facebook::react
You can’t perform that action at this time.
0 commit comments