Skip to content

Commit b59cee6

Browse files
cleanup
1 parent 03bb60a commit b59cee6

File tree

4 files changed

+10
-33
lines changed

4 files changed

+10
-33
lines changed

packages/react-native/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ void ViewShadowNode::updateStateIfNeeded() {
112112
const auto& viewProps = static_cast<const ViewProps&>(*props_);
113113
const auto& backgroundImages = viewProps.backgroundImage;
114114

115-
std::vector<BackgroundImageRequest> newRequests;
115+
std::vector<BackgroundImageURLRequest> newRequests;
116116
for (const auto& bgImage : backgroundImages) {
117117
if (std::holds_alternative<URLBackgroundImage>(bgImage)) {
118118
const auto& urlBgImage = std::get<URLBackgroundImage>(bgImage);
119119
if (!urlBgImage.uri.empty()) {
120-
BackgroundImageRequest request;
120+
BackgroundImageURLRequest request;
121121
request.imageSource.uri = urlBgImage.uri;
122122
if (urlBgImage.uri.find("__packager_asset") != std::string::npos) {
123123
request.imageSource.type = ImageSource::Type::Local;

packages/react-native/ReactCommon/react/renderer/components/view/ViewShadowNode.h

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,14 @@ class ViewShadowNodeProps final : public ViewProps {
3333
/*
3434
* `ShadowNode` for <View> component.
3535
*/
36-
class ViewShadowNode final
37-
: public ConcreteViewShadowNode<
38-
ViewComponentName,
39-
ViewShadowNodeProps,
40-
ViewEventEmitter,
41-
ViewState> {
36+
class ViewShadowNode final : public ConcreteViewShadowNode<ViewComponentName, ViewShadowNodeProps, ViewEventEmitter, ViewState> {
4237
public:
43-
ViewShadowNode(
44-
const ShadowNodeFragment &fragment,
45-
const ShadowNodeFamily::Shared &family,
46-
ShadowNodeTraits traits);
38+
ViewShadowNode(const ShadowNodeFragment &fragment, const ShadowNodeFamily::Shared &family, ShadowNodeTraits traits);
4739

48-
ViewShadowNode(
49-
const ShadowNode &sourceShadowNode,
50-
const ShadowNodeFragment &fragment);
40+
ViewShadowNode(const ShadowNode &sourceShadowNode, const ShadowNodeFragment &fragment);
5141

5242
void setImageManager(const std::shared_ptr<ImageManager> &imageManager);
5343

54-
static ViewState initialStateData(
55-
const Props::Shared &props,
56-
const ShadowNodeFamily::Shared & /*family*/,
57-
const ComponentDescriptor &componentDescriptor) {
58-
return {};
59-
}
60-
6144
#pragma mark - LayoutableShadowNode
6245

6346
void layout(LayoutContext layoutContext) override;

packages/react-native/ReactCommon/react/renderer/components/view/ViewState.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@
99

1010
namespace facebook::react {
1111

12-
const std::vector<BackgroundImageRequest>& ViewState::getBackgroundImageRequests()
12+
const std::vector<BackgroundImageURLRequest>& ViewState::getBackgroundImageRequests()
1313
const {
1414
return backgroundImageRequests_;
1515
}
1616

17-
bool ViewState::hasBackgroundImageRequests() const {
18-
return !backgroundImageRequests_.empty();
19-
}
20-
2117
} // namespace facebook::react

packages/react-native/ReactCommon/react/renderer/components/view/ViewState.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace facebook::react {
1919

20-
struct BackgroundImageRequest {
20+
struct BackgroundImageURLRequest {
2121
ImageSource imageSource{};
2222
std::shared_ptr<ImageRequest> imageRequest{};
2323
};
@@ -26,12 +26,10 @@ class ViewState final {
2626
public:
2727
ViewState() = default;
2828

29-
explicit ViewState(std::vector<BackgroundImageRequest> backgroundImageRequests)
29+
explicit ViewState(std::vector<BackgroundImageURLRequest> backgroundImageRequests)
3030
: backgroundImageRequests_(std::move(backgroundImageRequests)) {}
3131

32-
const std::vector<BackgroundImageRequest>& getBackgroundImageRequests() const;
33-
34-
bool hasBackgroundImageRequests() const;
32+
const std::vector<BackgroundImageURLRequest>& getBackgroundImageRequests() const;
3533

3634
#ifdef ANDROID
3735
ViewState(const ViewState& previousState, folly::dynamic data) {}
@@ -42,7 +40,7 @@ class ViewState final {
4240
#endif
4341

4442
private:
45-
std::vector<BackgroundImageRequest> backgroundImageRequests_;
43+
std::vector<BackgroundImageURLRequest> backgroundImageRequests_;
4644
};
4745

4846
} // namespace facebook::react

0 commit comments

Comments
 (0)