Skip to content

Commit fe224a5

Browse files
Load background url() images at mount on iOS
Move url() loading out of ViewShadowNode, ViewState, and ViewComponentDescriptor. RCTViewComponentView now starts the requests in finalizeUpdates through RCTBackgroundImageURLLoader, using the ImageManager that RCTMountingManager passes to the component view registry. No shared C++ or build file changes remain.
1 parent f4d9407 commit fe224a5

21 files changed

Lines changed: 377 additions & 451 deletions

‎packages/react-native/Package.swift‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ let reactCore = RNTarget(
455455
let reactFabric = RNTarget(
456456
name: .reactFabric,
457457
path: "ReactCommon/react/renderer",
458-
searchPaths: ["ReactCommon/react/renderer/imagemanager/platform/ios"],
459458
excludedPaths: [
460459
"animated/tests",
461460
"animations/tests",

‎packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTBackgroundImageURLLoader.h‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTBackgroundImageURLLoader.mm‎

Lines changed: 0 additions & 159 deletions
This file was deleted.

‎packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@
1717
#import <react/renderer/core/LayoutMetrics.h>
1818
#import <react/renderer/core/Props.h>
1919

20-
#import "RCTBackgroundImageURLLoader.h"
20+
#include <memory>
21+
22+
namespace facebook::react {
23+
class ImageManager;
24+
} // namespace facebook::react
2125

2226
NS_ASSUME_NONNULL_BEGIN
2327

2428
/**
2529
* UIView class for <View> component.
2630
*/
27-
@interface RCTViewComponentView : UIView <RCTComponentViewProtocol, RCTTouchableComponentViewProtocol, RCTBackgroundImageURLLoaderDelegate> {
31+
@interface RCTViewComponentView : UIView <RCTComponentViewProtocol, RCTTouchableComponentViewProtocol> {
2832
@protected
2933
facebook::react::LayoutMetrics _layoutMetrics;
3034
facebook::react::SharedViewProps _props;
@@ -65,6 +69,12 @@ NS_ASSUME_NONNULL_BEGIN
6569
*/
6670
@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
6771

72+
/**
73+
* Used to load the `url()` entries of `backgroundImage`.
74+
* Set by `RCTComponentViewRegistry` when it creates the view.
75+
*/
76+
- (void)setImageManager:(std::shared_ptr<facebook::react::ImageManager>)imageManager;
77+
6878
/**
6979
* Enforcing `call super` semantic for overridden methods from `RCTComponentViewProtocol`.
7080
* The methods update the instance variables.

0 commit comments

Comments
 (0)