Skip to content

Commit

Permalink
Revert D48140317: delete unused RCTSurfaceHostingView selectors
Browse files Browse the repository at this point in the history
Differential Revision:
D48140317

Original commit changeset: 930c79b3828e

Original Phabricator Diff: D48140317

fbshipit-source-id: b1a16b9c08dc2ee19aa39b63c9234fbf9fa81c35
  • Loading branch information
Lynden Kuwada authored and facebook-github-bot committed Aug 18, 2023
1 parent f2b1024 commit 9f47b6a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface RCTSurfaceHostingView : UIView <RCTSurfaceDelegate>

/**
* Create an instance of RCTSurface to be hosted.
*/
+ (RCTSurface *)createSurfaceWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties;

/**
* Designated initializer.
* Instantiates a view with given Surface object.
Expand All @@ -35,6 +42,16 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode NS_DESIGNATED_INITIALIZER;

/**
* Convenience initializer.
* Instantiates a Surface object with given `bridge`, `moduleName`, and
* `initialProperties`, and then use it to instantiate a view.
*/
- (instancetype)initWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode;

/**
* Surface object which is currently using to power the view.
* Read-only.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,31 @@ @implementation RCTSurfaceHostingView {
RCTSurfaceStage _stage;
}

+ (id<RCTSurfaceProtocol>)createSurfaceWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
{
return [[RCTSurface alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
}

RCT_NOT_IMPLEMENTED(-(instancetype)init)
RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)

- (instancetype)initWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
{
id<RCTSurfaceProtocol> surface = [[self class] createSurfaceWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties];
if (self = [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode]) {
[surface start];
}
return self;
}

- (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
{
Expand Down

0 comments on commit 9f47b6a

Please sign in to comment.