Skip to content

Commit

Permalink
Migrate Image to Plugins
Browse files Browse the repository at this point in the history
Summary: Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19088558

fbshipit-source-id: 10dfcef8d2a244318ded4d55b4e4805663d8139e
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Dec 19, 2019
1 parent e33b276 commit 5fc3b44
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#import <react/imagemanager/RCTImagePrimitivesConversions.h>

#import "RCTConversions.h"
#import "RCTFabricComponentsPlugins.h"

@interface RCTImageComponentView () <RCTImageResponseDelegate>
@end
Expand Down Expand Up @@ -195,3 +196,8 @@ - (void)didReceiveFailureFromObserver:(void const *)observer
}

@end

Class<RCTComponentViewProtocol> RCTImageCls(void)
{
return RCTImageComponentView.class;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Class<RCTComponentViewProtocol> RCTSwitchCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTUnimplementedNativeViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTModalHostViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTARTSurfaceViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTImageCls(void) __attribute__((used));

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
{"UnimplementedNativeView", RCTUnimplementedNativeViewCls},
{"ModalHostView", RCTModalHostViewCls},
{"ARTSurfaceView", RCTARTSurfaceViewCls},
{"Image", RCTImageCls},
};

auto p = sFabricComponentsClassMap.find(name);
Expand Down
9 changes: 8 additions & 1 deletion React/Fabric/Mounting/RCTComponentViewFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#import <React/RCTAssert.h>
#import <React/RCTConversions.h>
#import <glog/logging.h>

#import <better/map.h>
#import <better/mutex.h>
Expand Down Expand Up @@ -43,9 +44,15 @@ + (RCTComponentViewFactory *)standardComponentViewFactory

[componentViewFactory registerComponentViewClass:[RCTRootComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTViewComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTImageComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTParagraphComponentView class]];

Class<RCTComponentViewProtocol> imageClass = RCTComponentViewClassWithName("Image");
if (imageClass) {
[componentViewFactory registerComponentViewClass:imageClass];
} else {
LOG(FATAL) << "Image component not found";
}

auto providerRegistry = &componentViewFactory->_providerRegistry;

providerRegistry->setComponentDescriptorProviderRequest(
Expand Down

0 comments on commit 5fc3b44

Please sign in to comment.