iOS: codemod react-native-github: RCT->RN prefix for Fabric

Summary: Fabric ObjC(++) files will be prefixed by RN* for the time being, this codemod is a simple rename. This includes `interface` and `protocol` definition

Reviewed By: PeteTheHeat, yungsters

Differential Revision: D16611524

fbshipit-source-id: 868d2571ea2414dde4cbb3b75b1334b779b5d832
This commit is contained in:
Kevin Gozali 2019-08-01 20:01:19 -07:00 коммит произвёл Facebook Github Bot
Родитель e3ec8dbe15
Коммит 9420de6860
63 изменённых файлов: 430 добавлений и 431 удалений

Просмотреть файл

@ -8,7 +8,7 @@
#import <React/RCTPropsAnimatedNode.h>
#import <React/RCTLog.h>
#import <React/RCTSurfacePresenterStub.h>
#import <React/RNSurfacePresenterStub.h>
#import <React/RCTUIManager.h>
#import <React/RCTAnimationUtils.h>

Просмотреть файл

@ -8,13 +8,13 @@
#import <React/RCTBridgeModule.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTEventEmitter.h>
#import <React/RCTSurfacePresenterStub.h>
#import <React/RNSurfacePresenterStub.h>
#import <React/RCTUIManager.h>
#import <React/RCTUIManagerObserverCoordinator.h>
#import <React/RCTUIManagerUtils.h>
#import "RCTValueAnimatedNode.h"
@interface RCTNativeAnimatedModule : RCTEventEmitter <RCTBridgeModule, RCTValueAnimatedNodeObserver, RCTEventDispatcherObserver, RCTUIManagerObserver, RCTSurfacePresenterObserver>
@interface RCTNativeAnimatedModule : RCTEventEmitter <RCTBridgeModule, RCTValueAnimatedNodeObserver, RCTEventDispatcherObserver, RCTUIManagerObserver, RNSurfacePresenterObserver>
@end

Просмотреть файл

@ -231,7 +231,7 @@ RCT_EXPORT_METHOD(removeAnimatedEventFromView:(nonnull NSNumber *)viewTag
});
}
#pragma mark - RCTSurfacePresenterObserver
#pragma mark - RNSurfacePresenterObserver
- (void)willMountComponentsWithRootTag:(NSInteger)rootTag
{

Просмотреть файл

@ -23,8 +23,8 @@
#endif
#ifdef RN_FABRIC_ENABLED
#import <React/RCTSurfacePresenter.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RNSurfacePresenter.h>
#import <React/RNFabricSurfaceHostingProxyRootView.h>
#endif
#import <ReactCommon/RCTTurboModuleManager.h>
@ -34,7 +34,7 @@
@interface AppDelegate() <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate>{
#ifdef RN_FABRIC_ENABLED
RCTSurfacePresenter *_surfacePresenter;
RNSurfacePresenter *_surfacePresenter;
#endif
RCTTurboModuleManager *_turboModuleManager;
@ -58,10 +58,10 @@
}
#ifdef RN_FABRIC_ENABLED
_surfacePresenter = [[RCTSurfacePresenter alloc] initWithBridge:_bridge config:nil];
_surfacePresenter = [[RNSurfacePresenter alloc] initWithBridge:_bridge config:nil];
_bridge.surfacePresenter = _surfacePresenter;
UIView *rootView = [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:_bridge moduleName:@"RNTesterApp" initialProperties:initProps];
UIView *rootView = [[RNFabricSurfaceHostingProxyRootView alloc] initWithBridge:_bridge moduleName:@"RNTesterApp" initialProperties:initProps];
#else
UIView *rootView = [[RCTRootView alloc] initWithBridge:_bridge moduleName:@"RNTesterApp" initialProperties:initProps];
#endif

Просмотреть файл

@ -7,14 +7,14 @@
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
#import <React/RNViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
/**
* UIView class for root <ActivityIndicator> component.
*/
@interface RCTActivityIndicatorViewComponentView : RCTViewComponentView
@interface RNActivityIndicatorViewComponentView : RNViewComponentView
@end

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTActivityIndicatorViewComponentView.h"
#import "RNActivityIndicatorViewComponentView.h"
#import <react/components/rncore/ComponentDescriptors.h>
#import <react/components/rncore/EventEmitters.h>
@ -23,11 +23,11 @@ static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const Acti
}
}
@implementation RCTActivityIndicatorViewComponentView {
@implementation RNActivityIndicatorViewComponentView {
UIActivityIndicatorView *_activityIndicatorView;
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{

Просмотреть файл

@ -5,15 +5,15 @@
* LICENSE file in the root directory of this source tree.
*/
#import <React/RCTImageResponseDelegate.h>
#import "RCTViewComponentView.h"
#import <React/RNImageResponseDelegate.h>
#import "RNViewComponentView.h"
NS_ASSUME_NONNULL_BEGIN
/**
* UIView class for root <Image> component.
*/
@interface RCTImageComponentView : RCTViewComponentView <RCTImageResponseDelegate>
@interface RNImageComponentView : RNViewComponentView <RNImageResponseDelegate>
@end

Просмотреть файл

@ -5,9 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTImageComponentView.h"
#import "RNImageComponentView.h"
#import <React/RCTImageResponseObserverProxy.h>
#import <React/RNImageResponseObserverProxy.h>
#import <react/components/image/ImageComponentDescriptor.h>
#import <react/components/image/ImageEventEmitter.h>
#import <react/components/image/ImageLocalData.h>
@ -15,13 +15,13 @@
#import <react/imagemanager/ImageRequest.h>
#import <react/imagemanager/RCTImagePrimitivesConversions.h>
#import "RCTConversions.h"
#import "RNConversions.h"
@implementation RCTImageComponentView {
@implementation RNImageComponentView {
UIImageView *_imageView;
SharedImageLocalData _imageLocalData;
const ImageResponseObserverCoordinator *_coordinator;
std::unique_ptr<RCTImageResponseObserverProxy> _imageResponseObserverProxy;
std::unique_ptr<RNImageResponseObserverProxy> _imageResponseObserverProxy;
}
- (instancetype)initWithFrame:(CGRect)frame
@ -35,7 +35,7 @@
_imageView.contentMode = (UIViewContentMode)RCTResizeModeFromImageResizeMode(defaultProps->resizeMode);
_imageResponseObserverProxy = std::make_unique<RCTImageResponseObserverProxy>((__bridge void *)self);
_imageResponseObserverProxy = std::make_unique<RNImageResponseObserverProxy>((__bridge void *)self);
self.contentView = _imageView;
}
@ -43,7 +43,7 @@
return self;
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
@ -125,7 +125,7 @@
_imageResponseObserverProxy.reset();
}
#pragma mark - RCTImageResponseDelegate
#pragma mark - RNImageResponseDelegate
- (void)didReceiveImage:(UIImage *)image fromObserver:(void *)observer
{

Просмотреть файл

@ -5,11 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/
#import <React/RCTViewComponentView.h>
#import <React/RNViewComponentView.h>
/**
* UIView class for root <ModalHostView> component.
*/
@interface RNModalHostViewComponentView : RCTViewComponentView
@interface RNModalHostViewComponentView : RNViewComponentView
@end

Просмотреть файл

@ -13,7 +13,7 @@
#import <react/components/modal/ModalHostViewState.h>
#import <react/components/rncore/EventEmitters.h>
#import <react/components/rncore/Props.h>
#import "RCTConversions.h"
#import "RNConversions.h"
using namespace facebook::react;
@ -164,7 +164,7 @@ static ModalHostViewOnOrientationChangeStruct onOrientationChangeStruct(CGRect r
}
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
@ -194,12 +194,12 @@ static ModalHostViewOnOrientationChangeStruct onOrientationChangeStruct(CGRect r
_state = std::static_pointer_cast<const ModalHostViewShadowNode::ConcreteState>(state);
}
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
- (void)mountChildComponentView:(UIView<RNComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
[_viewController.view insertSubview:childComponentView atIndex:index];
}
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
- (void)unmountChildComponentView:(UIView<RNComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
[childComponentView removeFromSuperview];
}

Просмотреть файл

@ -8,11 +8,11 @@
#import "RNModalHostViewController.h"
#import <React/RCTLog.h>
#import <React/RCTSurfaceTouchHandler.h>
#import <React/RNSurfaceTouchHandler.h>
@implementation RNModalHostViewController {
CGRect _lastViewBounds;
RCTSurfaceTouchHandler *_touchHandler;
RNSurfaceTouchHandler *_touchHandler;
}
- (instancetype)init
@ -20,7 +20,7 @@
if (!(self = [super init])) {
return nil;
}
_touchHandler = [RCTSurfaceTouchHandler new];
_touchHandler = [RNSurfaceTouchHandler new];
return self;
}

Просмотреть файл

@ -7,14 +7,14 @@
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
#import <React/RNViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
/**
* UIView class for root <View> component.
*/
@interface RCTRootComponentView : RCTViewComponentView
@interface RNRootComponentView : RNViewComponentView
@end

Просмотреть файл

@ -5,14 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTRootComponentView.h"
#import "RNRootComponentView.h"
#import <react/components/root/RootComponentDescriptor.h>
#import <react/components/root/RootProps.h>
using namespace facebook::react;
@implementation RCTRootComponentView
@implementation RNRootComponentView
- (instancetype)initWithFrame:(CGRect)frame
{
@ -24,7 +24,7 @@ using namespace facebook::react;
return self;
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{

Просмотреть файл

@ -7,7 +7,7 @@
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
#import <React/RNViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
* `UIScrollView` subclass which has some improvements and tweaks
* which are not directly related to React.
*/
@interface RCTEnhancedScrollView : UIScrollView
@interface RNEnhancedScrollView : UIScrollView
@property (nonatomic, assign) BOOL pinchGestureEnabled;
@property (nonatomic, assign) BOOL centerContent;

Просмотреть файл

@ -5,9 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTEnhancedScrollView.h"
#import "RNEnhancedScrollView.h"
@implementation RCTEnhancedScrollView
@implementation RNEnhancedScrollView
- (instancetype)initWithFrame:(CGRect)frame
{

Просмотреть файл

@ -7,7 +7,7 @@
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
#import <React/RNViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
* This view is designed to only serve ViewController-like purpose for the actual `UIRefreshControl` view which is being
* attached to some `UIScrollView` (not to this view).
*/
@interface RNPullToRefreshViewComponentView : RCTViewComponentView
@interface RNPullToRefreshViewComponentView : RNViewComponentView
@end

Просмотреть файл

@ -11,14 +11,14 @@
#import <react/components/rncore/EventEmitters.h>
#import <react/components/rncore/Props.h>
#import <React/RCTConversions.h>
#import <React/RCTScrollViewComponentView.h>
#import <React/RNConversions.h>
#import <React/RNScrollViewComponentView.h>
using namespace facebook::react;
@implementation RNPullToRefreshViewComponentView {
UIRefreshControl *_refreshControl;
RCTScrollViewComponentView *_scrollViewComponentView;
RNScrollViewComponentView *_scrollViewComponentView;
}
- (instancetype)initWithFrame:(CGRect)frame
@ -41,7 +41,7 @@ using namespace facebook::react;
return self;
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
@ -120,7 +120,7 @@ using namespace facebook::react;
[self _detach];
}
_scrollViewComponentView = [RCTScrollViewComponentView findScrollViewComponentViewForView:self];
_scrollViewComponentView = [RNScrollViewComponentView findScrollViewComponentViewForView:self];
if (!_scrollViewComponentView) {
return;
}

Просмотреть файл

@ -8,8 +8,8 @@
#import <UIKit/UIKit.h>
#import <React/RCTScrollableProtocol.h>
#import <React/RCTViewComponentView.h>
#import <React/RNGenericDelegateSplitter.h>
#import <React/RNViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
@ -21,12 +21,12 @@ NS_ASSUME_NONNULL_BEGIN
* keyboard-avoiding functionality and so on. All that complexity must be implemented inside those components in order
* to keep the complexity of this component manageable.
*/
@interface RCTScrollViewComponentView : RCTViewComponentView
@interface RNScrollViewComponentView : RNViewComponentView
/*
* Finds and returns the closet RCTScrollViewComponentView component to the given view
* Finds and returns the closet RNScrollViewComponentView component to the given view
*/
+ (RCTScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(UIView *)view;
+ (RNScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(UIView *)view;
/*
* Returns an actual UIScrollView that this component uses under the hood.
@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN
* Until Fabric has own command-execution pipeline we have to support that to some extent. The implementation shouldn't
* be perfect though because very soon we will migrate that to the new commands infra and get rid of this.
*/
@interface RCTScrollViewComponentView (ScrollableProtocol) <RCTScrollableProtocol>
@interface RNScrollViewComponentView (ScrollableProtocol) <RCTScrollableProtocol>
@end

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTScrollViewComponentView.h"
#import "RNScrollViewComponentView.h"
#import <React/RCTAssert.h>
@ -15,28 +15,28 @@
#import <react/components/scrollview/ScrollViewState.h>
#import <react/graphics/Geometry.h>
#import "RCTConversions.h"
#import "RCTEnhancedScrollView.h"
#import "RNConversions.h"
#import "RNEnhancedScrollView.h"
using namespace facebook::react;
@interface RCTScrollViewComponentView () <UIScrollViewDelegate>
@interface RNScrollViewComponentView () <UIScrollViewDelegate>
@property (nonatomic, assign) CGFloat scrollEventThrottle;
@end
@implementation RCTScrollViewComponentView {
@implementation RNScrollViewComponentView {
ScrollViewShadowNode::ConcreteState::Shared _state;
CGSize _contentSize;
}
+ (RCTScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(UIView *)view
+ (RNScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(UIView *)view
{
do {
view = view.superview;
} while (view != nil && ![view isKindOfClass:[RCTScrollViewComponentView class]]);
return (RCTScrollViewComponentView *)view;
} while (view != nil && ![view isKindOfClass:[RNScrollViewComponentView class]]);
return (RNScrollViewComponentView *)view;
}
- (instancetype)initWithFrame:(CGRect)frame
@ -45,7 +45,7 @@ using namespace facebook::react;
static const auto defaultProps = std::make_shared<const ScrollViewProps>();
_props = defaultProps;
_scrollView = [[RCTEnhancedScrollView alloc] initWithFrame:self.bounds];
_scrollView = [[RNEnhancedScrollView alloc] initWithFrame:self.bounds];
_scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_scrollView.delaysContentTouches = NO;
[self addSubview:_scrollView];
@ -64,7 +64,7 @@ using namespace facebook::react;
return self;
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
@ -84,7 +84,7 @@ using namespace facebook::react;
#define REMAP_VIEW_PROP(reactName, localName) REMAP_PROP(reactName, localName, self)
#define MAP_VIEW_PROP(name) REMAP_VIEW_PROP(name, name)
#define REMAP_SCROLL_VIEW_PROP(reactName, localName) \
REMAP_PROP(reactName, localName, ((RCTEnhancedScrollView *)_scrollView))
REMAP_PROP(reactName, localName, ((RNEnhancedScrollView *)_scrollView))
#define MAP_SCROLL_VIEW_PROP(name) REMAP_SCROLL_VIEW_PROP(name, name)
// FIXME: Commented props are not supported yet.
@ -137,12 +137,12 @@ using namespace facebook::react;
_scrollView.contentSize = contentSize;
}
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
- (void)mountChildComponentView:(UIView<RNComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
[_containerView insertSubview:childComponentView atIndex:index];
}
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
- (void)unmountChildComponentView:(UIView<RNComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
RCTAssert(childComponentView.superview == _containerView, @"Attempt to unmount improperly mounted component view.");
[childComponentView removeFromSuperview];
@ -267,7 +267,7 @@ using namespace facebook::react;
@end
@implementation RCTScrollViewComponentView (ScrollableProtocol)
@implementation RNScrollViewComponentView (ScrollableProtocol)
- (CGSize)contentSize
{

Просмотреть файл

@ -7,14 +7,14 @@
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
#import <React/RNViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
/**
* UIView class for root <Slider> component.
*/
@interface RCTSliderComponentView : RCTViewComponentView
@interface RNSliderComponentView : RNViewComponentView
@end

Просмотреть файл

@ -5,9 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTSliderComponentView.h"
#import "RNSliderComponentView.h"
#import <React/RCTImageResponseObserverProxy.h>
#import <React/RNImageResponseObserverProxy.h>
#import <react/components/rncore/EventEmitters.h>
#import <react/components/rncore/Props.h>
#import <react/components/slider/SliderComponentDescriptor.h>
@ -15,7 +15,7 @@
using namespace facebook::react;
@implementation RCTSliderComponentView {
@implementation RNSliderComponentView {
UISlider *_sliderView;
float _previousValue;
SharedSliderLocalData _sliderLocalData;
@ -30,10 +30,10 @@ using namespace facebook::react;
const ImageResponseObserverCoordinator *_maximumTrackImageCoordinator;
const ImageResponseObserverCoordinator *_thumbImageCoordinator;
std::unique_ptr<RCTImageResponseObserverProxy> _trackImageResponseObserverProxy;
std::unique_ptr<RCTImageResponseObserverProxy> _minimumTrackImageResponseObserverProxy;
std::unique_ptr<RCTImageResponseObserverProxy> _maximumTrackImageResponseObserverProxy;
std::unique_ptr<RCTImageResponseObserverProxy> _thumbImageResponseObserverProxy;
std::unique_ptr<RNImageResponseObserverProxy> _trackImageResponseObserverProxy;
std::unique_ptr<RNImageResponseObserverProxy> _minimumTrackImageResponseObserverProxy;
std::unique_ptr<RNImageResponseObserverProxy> _maximumTrackImageResponseObserverProxy;
std::unique_ptr<RNImageResponseObserverProxy> _thumbImageResponseObserverProxy;
}
- (instancetype)initWithFrame:(CGRect)frame
@ -51,10 +51,10 @@ using namespace facebook::react;
_sliderView.value = defaultProps->value;
_trackImageResponseObserverProxy = std::make_unique<RCTImageResponseObserverProxy>((__bridge void *)self);
_minimumTrackImageResponseObserverProxy = std::make_unique<RCTImageResponseObserverProxy>((__bridge void *)self);
_maximumTrackImageResponseObserverProxy = std::make_unique<RCTImageResponseObserverProxy>((__bridge void *)self);
_thumbImageResponseObserverProxy = std::make_unique<RCTImageResponseObserverProxy>((__bridge void *)self);
_trackImageResponseObserverProxy = std::make_unique<RNImageResponseObserverProxy>((__bridge void *)self);
_minimumTrackImageResponseObserverProxy = std::make_unique<RNImageResponseObserverProxy>((__bridge void *)self);
_maximumTrackImageResponseObserverProxy = std::make_unique<RNImageResponseObserverProxy>((__bridge void *)self);
_thumbImageResponseObserverProxy = std::make_unique<RNImageResponseObserverProxy>((__bridge void *)self);
self.contentView = _sliderView;
}
@ -100,7 +100,7 @@ using namespace facebook::react;
_thumbImageResponseObserverProxy.reset();
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
@ -310,7 +310,7 @@ using namespace facebook::react;
_previousValue = value;
}
#pragma mark - RCTImageResponseDelegate
#pragma mark - RNImageResponseDelegate
- (void)didReceiveImage:(UIImage *)image fromObserver:(void *)observer
{

Просмотреть файл

@ -7,14 +7,14 @@
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
#import <React/RNViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
/**
* UIView class for root <Switch> component.
*/
@interface RCTSwitchComponentView : RCTViewComponentView
@interface RNSwitchComponentView : RNViewComponentView
@end

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTSwitchComponentView.h"
#import "RNSwitchComponentView.h"
#import <react/components/rncore/ComponentDescriptors.h>
#import <react/components/rncore/EventEmitters.h>
@ -13,7 +13,7 @@
using namespace facebook::react;
@implementation RCTSwitchComponentView {
@implementation RNSwitchComponentView {
UISwitch *_switchView;
BOOL _wasOn;
}
@ -36,7 +36,7 @@ using namespace facebook::react;
return self;
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{

Просмотреть файл

@ -7,14 +7,14 @@
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
#import <React/RNViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
/**
* UIView class for <Paragraph> component.
*/
@interface RCTParagraphComponentView : RCTViewComponentView
@interface RNParagraphComponentView : RNViewComponentView
@end

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTParagraphComponentView.h"
#import "RNParagraphComponentView.h"
#import <react/components/text/ParagraphComponentDescriptor.h>
#import <react/components/text/ParagraphProps.h>
@ -16,11 +16,11 @@
#import <react/graphics/Geometry.h>
#import <react/textlayoutmanager/RCTTextLayoutManager.h>
#import <react/textlayoutmanager/TextLayoutManager.h>
#import "RCTConversions.h"
#import "RNConversions.h"
using namespace facebook::react;
@implementation RCTParagraphComponentView {
@implementation RNParagraphComponentView {
ParagraphShadowNode::ConcreteState::Shared _state;
ParagraphAttributes _paragraphAttributes;
}
@ -40,7 +40,7 @@ using namespace facebook::react;
return self;
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{

Просмотреть файл

@ -7,11 +7,11 @@
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
#import <React/RNViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
@interface RCTUnimplementedNativeComponentView : RCTViewComponentView
@interface RNUnimplementedNativeComponentView : RNViewComponentView
@end

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTUnimplementedNativeComponentView.h"
#import "RNUnimplementedNativeComponentView.h"
#import <react/components/rncore/ComponentDescriptors.h>
#import <react/components/rncore/EventEmitters.h>
@ -13,7 +13,7 @@
using namespace facebook::react;
@implementation RCTUnimplementedNativeComponentView {
@implementation RNUnimplementedNativeComponentView {
UILabel *_label;
}
@ -38,7 +38,7 @@ using namespace facebook::react;
return self;
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{

Просмотреть файл

@ -7,8 +7,8 @@
#import <UIKit/UIKit.h>
#import <React/RCTComponentViewProtocol.h>
#import <React/RCTTouchableComponentViewProtocol.h>
#import <React/RNComponentViewProtocol.h>
#import <React/RNTouchableComponentViewProtocol.h>
#import <React/UIView+ComponentViewProtocol.h>
#import <react/components/view/ViewEventEmitter.h>
#import <react/components/view/ViewProps.h>
@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* UIView class for <View> component.
*/
@interface RCTViewComponentView : UIView <RCTComponentViewProtocol, RCTTouchableComponentViewProtocol> {
@interface RNViewComponentView : UIView <RNComponentViewProtocol, RNTouchableComponentViewProtocol> {
@protected
facebook::react::LayoutMetrics _layoutMetrics;
facebook::react::SharedViewProps _props;
@ -69,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
/**
* Enforcing `call super` semantic for overridden methods from `RCTComponentViewProtocol`.
* Enforcing `call super` semantic for overridden methods from `RNComponentViewProtocol`.
* The methods update the instance variables.
*/
- (void)updateProps:(facebook::react::Props::Shared const &)props

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTViewComponentView.h"
#import "RNViewComponentView.h"
#import <React/RCTAssert.h>
#import <React/RCTBorderDrawing.h>
@ -14,11 +14,11 @@
#import <react/components/view/ViewEventEmitter.h>
#import <react/components/view/ViewProps.h>
#import "RCTConversions.h"
#import "RNConversions.h"
using namespace facebook::react;
@implementation RCTViewComponentView {
@implementation RNViewComponentView {
UIColor *_backgroundColor;
CALayer *_borderLayer;
BOOL _needsInvalidateLayer;
@ -83,13 +83,13 @@ using namespace facebook::react;
_backgroundColor = backgroundColor;
}
#pragma mark - RCTComponentViewProtocol
#pragma mark - RNComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
RCTAssert(
self == [RCTViewComponentView class],
@"`+[RCTComponentViewProtocol componentDescriptorProvider]` must be implemented for all subclasses (and `%@` particularly).",
self == [RNViewComponentView class],
@"`+[RNComponentViewProtocol componentDescriptorProvider]` must be implemented for all subclasses (and `%@` particularly).",
NSStringFromClass([self class]));
return concreteComponentDescriptorProvider<ViewComponentDescriptor>();
}
@ -100,9 +100,9 @@ using namespace facebook::react;
auto propsRawPtr = _props.get();
RCTAssert(
propsRawPtr &&
([self class] == [RCTViewComponentView class] ||
([self class] == [RNViewComponentView class] ||
typeid(*propsRawPtr).hash_code() != typeid(ViewProps const).hash_code()),
@"`RCTViewComponentView` subclasses (and `%@` particularly) must setup `_props`"
@"`RNViewComponentView` subclasses (and `%@` particularly) must setup `_props`"
" instance variable with a default value in the constructor.",
NSStringFromClass([self class]));
#endif

Просмотреть файл

@ -7,7 +7,7 @@
#import <UIKit/UIKit.h>
#import <React/RCTComponentViewProtocol.h>
#import <React/RNComponentViewProtocol.h>
#import <react/uimanager/ComponentDescriptorRegistry.h>
@ -17,27 +17,27 @@ NS_ASSUME_NONNULL_BEGIN
* Registry of supported component view classes that can instantiate
* view component instances by given component handle.
*/
@interface RCTComponentViewFactory : NSObject
@interface RNComponentViewFactory : NSObject
/**
* Constructs and returns an instance of the class with a bunch of already registered standard components.
*/
+ (RCTComponentViewFactory *)standardComponentViewFactory;
+ (RNComponentViewFactory *)standardComponentViewFactory;
/**
* Registers a component view class in the factory.
*/
- (void)registerComponentViewClass:(Class<RCTComponentViewProtocol>)componentViewClass;
- (void)registerComponentViewClass:(Class<RNComponentViewProtocol>)componentViewClass;
/**
* Unregisters a component view class in the factory.
*/
- (void)unregisterComponentViewClass:(Class<RCTComponentViewProtocol>)componentViewClass;
- (void)unregisterComponentViewClass:(Class<RNComponentViewProtocol>)componentViewClass;
/**
* Creates a component view with given component handle.
*/
- (UIView<RCTComponentViewProtocol> *)createComponentViewWithComponentHandle:
- (UIView<RNComponentViewProtocol> *)createComponentViewWithComponentHandle:
(facebook::react::ComponentHandle)componentHandle;
/**

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTComponentViewFactory.h"
#import "RNComponentViewFactory.h"
#import <React/RCTAssert.h>
#import <better/map.h>
@ -14,46 +14,46 @@
#import <react/core/ReactPrimitives.h>
#import <react/uimanager/ComponentDescriptorProviderRegistry.h>
#import "RCTActivityIndicatorViewComponentView.h"
#import "RCTImageComponentView.h"
#import "RCTParagraphComponentView.h"
#import "RCTRootComponentView.h"
#import "RCTScrollViewComponentView.h"
#import "RCTSliderComponentView.h"
#import "RCTSwitchComponentView.h"
#import "RCTUnimplementedNativeComponentView.h"
#import "RCTViewComponentView.h"
#import "RNActivityIndicatorViewComponentView.h"
#import "RNImageComponentView.h"
#import "RNModalHostViewComponentView.h"
#import "RNParagraphComponentView.h"
#import "RNPullToRefreshViewComponentView.h"
#import "RNRootComponentView.h"
#import "RNScrollViewComponentView.h"
#import "RNSliderComponentView.h"
#import "RNSwitchComponentView.h"
#import "RNUnimplementedNativeComponentView.h"
#import "RNViewComponentView.h"
using namespace facebook::react;
@implementation RCTComponentViewFactory {
better::map<ComponentHandle, Class<RCTComponentViewProtocol>> _componentViewClasses;
@implementation RNComponentViewFactory {
better::map<ComponentHandle, Class<RNComponentViewProtocol>> _componentViewClasses;
ComponentDescriptorProviderRegistry _providerRegistry;
better::shared_mutex _mutex;
}
+ (RCTComponentViewFactory *)standardComponentViewFactory
+ (RNComponentViewFactory *)standardComponentViewFactory
{
RCTComponentViewFactory *componentViewFactory = [[RCTComponentViewFactory alloc] init];
RNComponentViewFactory *componentViewFactory = [[RNComponentViewFactory alloc] init];
[componentViewFactory registerComponentViewClass:[RCTViewComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTRootComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTScrollViewComponentView class]];
[componentViewFactory registerComponentViewClass:[RNViewComponentView class]];
[componentViewFactory registerComponentViewClass:[RNRootComponentView class]];
[componentViewFactory registerComponentViewClass:[RNScrollViewComponentView class]];
[componentViewFactory registerComponentViewClass:[RNPullToRefreshViewComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTImageComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTParagraphComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTActivityIndicatorViewComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTSliderComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTSwitchComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTUnimplementedNativeComponentView class]];
[componentViewFactory registerComponentViewClass:[RNImageComponentView class]];
[componentViewFactory registerComponentViewClass:[RNParagraphComponentView class]];
[componentViewFactory registerComponentViewClass:[RNActivityIndicatorViewComponentView class]];
[componentViewFactory registerComponentViewClass:[RNSliderComponentView class]];
[componentViewFactory registerComponentViewClass:[RNSwitchComponentView class]];
[componentViewFactory registerComponentViewClass:[RNUnimplementedNativeComponentView class]];
[componentViewFactory registerComponentViewClass:[RNModalHostViewComponentView class]];
return componentViewFactory;
}
- (void)registerComponentViewClass:(Class<RCTComponentViewProtocol>)componentViewClass
- (void)registerComponentViewClass:(Class<RNComponentViewProtocol>)componentViewClass
{
std::unique_lock<better::shared_mutex> lock(_mutex);
@ -67,7 +67,7 @@ using namespace facebook::react;
}
}
- (void)unregisterComponentViewClass:(Class<RCTComponentViewProtocol>)componentViewClass
- (void)unregisterComponentViewClass:(Class<RNComponentViewProtocol>)componentViewClass
{
std::unique_lock<better::shared_mutex> lock(_mutex);
@ -76,7 +76,7 @@ using namespace facebook::react;
_providerRegistry.remove(componentDescriptorProvider);
}
- (UIView<RCTComponentViewProtocol> *)createComponentViewWithComponentHandle:
- (UIView<RNComponentViewProtocol> *)createComponentViewWithComponentHandle:
(facebook::react::ComponentHandle)componentHandle
{
RCTAssertMainQueue();

Просмотреть файл

@ -7,7 +7,7 @@
#import <UIKit/UIKit.h>
#import <React/RCTPrimitives.h>
#import <React/RNPrimitives.h>
#import <react/core/EventEmitter.h>
#import <react/core/LayoutMetrics.h>
#import <react/core/LocalData.h>
@ -38,7 +38,7 @@ typedef NS_OPTIONS(NSInteger, RNComponentViewUpdateMask) {
* `UIView+ComponentViewProtocol` category provides default implementation
* for all of them.
*/
@protocol RCTComponentViewProtocol <NSObject>
@protocol RNComponentViewProtocol <NSObject>
/*
* Returns a `ComponentDescriptorProvider` of a particular `ComponentDescriptor` which this component view
@ -57,14 +57,14 @@ typedef NS_OPTIONS(NSInteger, RNComponentViewUpdateMask) {
* component view.
* Receiver must add `childComponentView` as a subview.
*/
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
- (void)mountChildComponentView:(UIView<RNComponentViewProtocol> *)childComponentView index:(NSInteger)index;
/*
* Called for unmounting (detaching) a child component view from `self`
* component view.
* Receiver must remove `childComponentView` as a subview.
*/
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
- (void)unmountChildComponentView:(UIView<RNComponentViewProtocol> *)childComponentView index:(NSInteger)index;
/*
* Called for updating component's props.

Просмотреть файл

@ -7,8 +7,8 @@
#import <UIKit/UIKit.h>
#import <React/RCTComponentViewFactory.h>
#import <React/RCTComponentViewProtocol.h>
#import <React/RNComponentViewFactory.h>
#import <React/RNComponentViewProtocol.h>
#import <react/core/ReactPrimitives.h>
NS_ASSUME_NONNULL_BEGIN
@ -17,16 +17,16 @@ NS_ASSUME_NONNULL_BEGIN
* Registry of native component views.
* Provides basic functionality for allocation, recycling, and querying (by tag) native view instances.
*/
@interface RCTComponentViewRegistry : NSObject
@interface RNComponentViewRegistry : NSObject
@property (nonatomic, strong, readonly) RCTComponentViewFactory *componentViewFactory;
@property (nonatomic, strong, readonly) RNComponentViewFactory *componentViewFactory;
/**
* Returns a native view instance from the recycle pool (or create)
* for given `componentHandle` and with given `tag`.
* #RefuseSingleUse
*/
- (UIView<RCTComponentViewProtocol> *)dequeueComponentViewWithComponentHandle:
- (UIView<RNComponentViewProtocol> *)dequeueComponentViewWithComponentHandle:
(facebook::react::ComponentHandle)componentHandle
tag:(ReactTag)tag;
@ -36,17 +36,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)enqueueComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle
tag:(ReactTag)tag
componentView:(UIView<RCTComponentViewProtocol> *)componentView;
componentView:(UIView<RNComponentViewProtocol> *)componentView;
/**
* Returns a native component view by given `tag`.
*/
- (UIView<RCTComponentViewProtocol> *)componentViewByTag:(ReactTag)tag;
- (UIView<RNComponentViewProtocol> *)componentViewByTag:(ReactTag)tag;
/**
* Returns `tag` associated with given `componentView`.
*/
- (ReactTag)tagByComponentView:(UIView<RCTComponentViewProtocol> *)componentView;
- (ReactTag)tagByComponentView:(UIView<RNComponentViewProtocol> *)componentView;
/**
* Creates a component view with a given type and puts it to the recycle pool.

Просмотреть файл

@ -5,14 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTComponentViewRegistry.h"
#import "RNComponentViewRegistry.h"
#import <Foundation/NSMapTable.h>
#import <React/RCTAssert.h>
#import "RCTImageComponentView.h"
#import "RCTParagraphComponentView.h"
#import "RCTViewComponentView.h"
#import "RNImageComponentView.h"
#import "RNParagraphComponentView.h"
#import "RNViewComponentView.h"
using namespace facebook::react;
@ -70,11 +70,11 @@ using namespace facebook::react;
#endif
const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;
const NSInteger RNComponentViewRegistryRecyclePoolMaxSize = 1024;
@implementation RCTComponentViewRegistry {
NSMapTable<id /* ReactTag */, UIView<RCTComponentViewProtocol> *> *_registry;
NSMapTable<id /* ComponentHandle */, NSHashTable<UIView<RCTComponentViewProtocol> *> *> *_recyclePool;
@implementation RNComponentViewRegistry {
NSMapTable<id /* ReactTag */, UIView<RNComponentViewProtocol> *> *_registry;
NSMapTable<id /* ComponentHandle */, NSHashTable<UIView<RNComponentViewProtocol> *> *> *_recyclePool;
}
- (instancetype)init
@ -85,7 +85,7 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;
_recyclePool =
[NSMapTable mapTableWithKeyOptions:NSPointerFunctionsOpaquePersonality | NSPointerFunctionsOpaqueMemory
valueOptions:NSPointerFunctionsObjectPersonality];
_componentViewFactory = [RCTComponentViewFactory standardComponentViewFactory];
_componentViewFactory = [RNComponentViewFactory standardComponentViewFactory];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleApplicationDidReceiveMemoryWarningNotification)
@ -106,9 +106,9 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;
// This data is based on empirical evidence which should represent the reality pretty well.
// Regular `<View>` has magnitude equals to `1` by definition.
std::vector<std::pair<ComponentHandle, float>> componentMagnitudes = {
{[RCTViewComponentView componentDescriptorProvider].handle, 1},
{[RCTImageComponentView componentDescriptorProvider].handle, 0.3},
{[RCTParagraphComponentView componentDescriptorProvider].handle, 0.3},
{[RNViewComponentView componentDescriptorProvider].handle, 1},
{[RNImageComponentView componentDescriptorProvider].handle, 0.3},
{[RNParagraphComponentView componentDescriptorProvider].handle, 0.3},
};
// `complexity` represents the complexity of a typical surface in a number of `<View>` components (with Flattening
@ -128,16 +128,16 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (UIView<RCTComponentViewProtocol> *)dequeueComponentViewWithComponentHandle:(ComponentHandle)componentHandle
- (UIView<RNComponentViewProtocol> *)dequeueComponentViewWithComponentHandle:(ComponentHandle)componentHandle
tag:(ReactTag)tag
{
RCTAssertMainQueue();
RCTAssert(
![_registry objectForKey:(__bridge id)(void *)tag],
@"RCTComponentViewRegistry: Attempt to dequeue already registered component.");
@"RNComponentViewRegistry: Attempt to dequeue already registered component.");
UIView<RCTComponentViewProtocol> *componentView = [self _dequeueComponentViewWithComponentHandle:componentHandle];
UIView<RNComponentViewProtocol> *componentView = [self _dequeueComponentViewWithComponentHandle:componentHandle];
componentView.tag = tag;
[_registry setObject:componentView forKey:(__bridge id)(void *)tag];
@ -150,13 +150,13 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;
- (void)enqueueComponentViewWithComponentHandle:(ComponentHandle)componentHandle
tag:(ReactTag)tag
componentView:(UIView<RCTComponentViewProtocol> *)componentView
componentView:(UIView<RNComponentViewProtocol> *)componentView
{
RCTAssertMainQueue();
RCTAssert(
[_registry objectForKey:(__bridge id)(void *)tag],
@"RCTComponentViewRegistry: Attempt to enqueue unregistered component.");
@"RNComponentViewRegistry: Attempt to enqueue unregistered component.");
#ifdef LEGACY_UIMANAGER_INTEGRATION_ENABLED
[RCTUIManager unregisterView:componentView];
@ -175,44 +175,44 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;
createComponentViewWithComponentHandle:componentHandle]];
}
- (UIView<RCTComponentViewProtocol> *)componentViewByTag:(ReactTag)tag
- (UIView<RNComponentViewProtocol> *)componentViewByTag:(ReactTag)tag
{
RCTAssertMainQueue();
return [_registry objectForKey:(__bridge id)(void *)tag];
}
- (ReactTag)tagByComponentView:(UIView<RCTComponentViewProtocol> *)componentView
- (ReactTag)tagByComponentView:(UIView<RNComponentViewProtocol> *)componentView
{
RCTAssertMainQueue();
return componentView.tag;
}
- (nullable UIView<RCTComponentViewProtocol> *)_dequeueComponentViewWithComponentHandle:(ComponentHandle)componentHandle
- (nullable UIView<RNComponentViewProtocol> *)_dequeueComponentViewWithComponentHandle:(ComponentHandle)componentHandle
{
RCTAssertMainQueue();
NSHashTable<UIView<RCTComponentViewProtocol> *> *componentViews =
NSHashTable<UIView<RNComponentViewProtocol> *> *componentViews =
[_recyclePool objectForKey:(__bridge id)(void *)componentHandle];
if (!componentViews || componentViews.count == 0) {
return [self.componentViewFactory createComponentViewWithComponentHandle:componentHandle];
}
UIView<RCTComponentViewProtocol> *componentView = [componentViews anyObject];
UIView<RNComponentViewProtocol> *componentView = [componentViews anyObject];
[componentViews removeObject:componentView];
return componentView;
}
- (void)_enqueueComponentViewWithComponentHandle:(ComponentHandle)componentHandle
componentView:(UIView<RCTComponentViewProtocol> *)componentView
componentView:(UIView<RNComponentViewProtocol> *)componentView
{
RCTAssertMainQueue();
NSHashTable<UIView<RCTComponentViewProtocol> *> *componentViews =
NSHashTable<UIView<RNComponentViewProtocol> *> *componentViews =
[_recyclePool objectForKey:(__bridge id)(void *)componentHandle];
if (!componentViews) {
componentViews = [NSHashTable hashTableWithOptions:NSPointerFunctionsObjectPersonality];
[_recyclePool setObject:componentViews forKey:(__bridge id)(void *)componentHandle];
}
if (componentViews.count >= RCTComponentViewRegistryRecyclePoolMaxSize) {
if (componentViews.count >= RNComponentViewRegistryRecyclePoolMaxSize) {
return;
}

Просмотреть файл

@ -7,8 +7,8 @@
#import <UIKit/UIKit.h>
#import <React/RCTMountingManagerDelegate.h>
#import <React/RCTPrimitives.h>
#import <React/RNMountingManagerDelegate.h>
#import <React/RNPrimitives.h>
#import <react/core/ComponentDescriptor.h>
#import <react/core/ReactPrimitives.h>
#import <react/mounting/MountingCoordinator.h>
@ -16,15 +16,15 @@
NS_ASSUME_NONNULL_BEGIN
@class RCTComponentViewRegistry;
@class RNComponentViewRegistry;
/**
* Manages mounting process.
*/
@interface RCTMountingManager : NSObject
@interface RNMountingManager : NSObject
@property (nonatomic, weak) id<RCTMountingManagerDelegate> delegate;
@property (nonatomic, strong) RCTComponentViewRegistry *componentViewRegistry;
@property (nonatomic, weak) id<RNMountingManagerDelegate> delegate;
@property (nonatomic, strong) RNComponentViewRegistry *componentViewRegistry;
/**
* Schedule a mounting transaction to be performed on the main thread.

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTMountingManager.h"
#import "RNMountingManager.h"
#import <better/map.h>
@ -16,25 +16,25 @@
#import <react/core/RawProps.h>
#import <react/debug/SystraceSection.h>
#import "RCTComponentViewProtocol.h"
#import "RCTComponentViewRegistry.h"
#import "RCTConversions.h"
#import "RNComponentViewProtocol.h"
#import "RNComponentViewRegistry.h"
#import "RNConversions.h"
using namespace facebook;
using namespace facebook::react;
// `Create` instruction
static void RNCreateMountInstruction(ShadowViewMutation const &mutation, RCTComponentViewRegistry *registry)
static void RNCreateMountInstruction(ShadowViewMutation const &mutation, RNComponentViewRegistry *registry)
{
[registry dequeueComponentViewWithComponentHandle:mutation.newChildShadowView.componentHandle
tag:mutation.newChildShadowView.tag];
}
// `Delete` instruction
static void RNDeleteMountInstruction(ShadowViewMutation const &mutation, RCTComponentViewRegistry *registry)
static void RNDeleteMountInstruction(ShadowViewMutation const &mutation, RNComponentViewRegistry *registry)
{
auto const &oldChildShadowView = mutation.oldChildShadowView;
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:oldChildShadowView.tag];
UIView<RNComponentViewProtocol> *componentView = [registry componentViewByTag:oldChildShadowView.tag];
assert(componentView != nil && "Attempt to delete unregistered component.");
@ -44,13 +44,13 @@ static void RNDeleteMountInstruction(ShadowViewMutation const &mutation, RCTComp
}
// `Insert` instruction
static void RNInsertMountInstruction(ShadowViewMutation const &mutation, RCTComponentViewRegistry *registry)
static void RNInsertMountInstruction(ShadowViewMutation const &mutation, RNComponentViewRegistry *registry)
{
auto const &newShadowView = mutation.newChildShadowView;
auto const &parentShadowView = mutation.parentShadowView;
UIView<RCTComponentViewProtocol> *childComponentView = [registry componentViewByTag:newShadowView.tag];
UIView<RCTComponentViewProtocol> *parentComponentView = [registry componentViewByTag:parentShadowView.tag];
UIView<RNComponentViewProtocol> *childComponentView = [registry componentViewByTag:newShadowView.tag];
UIView<RNComponentViewProtocol> *parentComponentView = [registry componentViewByTag:parentShadowView.tag];
assert(childComponentView != nil && "Attempt to mount unregistered component.");
assert(parentComponentView != nil && "Attempt to mount into unregistered component.");
@ -59,13 +59,13 @@ static void RNInsertMountInstruction(ShadowViewMutation const &mutation, RCTComp
}
// `Remove` instruction
static void RNRemoveMountInstruction(ShadowViewMutation const &mutation, RCTComponentViewRegistry *registry)
static void RNRemoveMountInstruction(ShadowViewMutation const &mutation, RNComponentViewRegistry *registry)
{
auto const &oldShadowView = mutation.oldChildShadowView;
auto const &parentShadowView = mutation.parentShadowView;
UIView<RCTComponentViewProtocol> *childComponentView = [registry componentViewByTag:oldShadowView.tag];
UIView<RCTComponentViewProtocol> *parentComponentView = [registry componentViewByTag:parentShadowView.tag];
UIView<RNComponentViewProtocol> *childComponentView = [registry componentViewByTag:oldShadowView.tag];
UIView<RNComponentViewProtocol> *parentComponentView = [registry componentViewByTag:parentShadowView.tag];
assert(childComponentView != nil && "Attempt to unmount unregistered component.");
assert(parentComponentView != nil && "Attempt to unmount from unregistered component.");
@ -74,48 +74,46 @@ static void RNRemoveMountInstruction(ShadowViewMutation const &mutation, RCTComp
}
// `Update Props` instruction
static void RNUpdatePropsMountInstruction(ShadowViewMutation const &mutation, RCTComponentViewRegistry *registry)
static void RNUpdatePropsMountInstruction(ShadowViewMutation const &mutation, RNComponentViewRegistry *registry)
{
auto const &oldShadowView = mutation.oldChildShadowView;
auto const &newShadowView = mutation.newChildShadowView;
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
UIView<RNComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
[componentView updateProps:newShadowView.props oldProps:oldShadowView.props];
}
// `Update EventEmitter` instruction
static void RNUpdateEventEmitterMountInstruction(ShadowViewMutation const &mutation, RCTComponentViewRegistry *registry)
static void RNUpdateEventEmitterMountInstruction(ShadowViewMutation const &mutation, RNComponentViewRegistry *registry)
{
auto const &newShadowView = mutation.newChildShadowView;
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
UIView<RNComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
[componentView updateEventEmitter:newShadowView.eventEmitter];
}
// `Update LayoutMetrics` instruction
static void RNUpdateLayoutMetricsMountInstruction(
ShadowViewMutation const &mutation,
RCTComponentViewRegistry *registry)
static void RNUpdateLayoutMetricsMountInstruction(ShadowViewMutation const &mutation, RNComponentViewRegistry *registry)
{
auto const &oldShadowView = mutation.oldChildShadowView;
auto const &newShadowView = mutation.newChildShadowView;
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
UIView<RNComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
[componentView updateLayoutMetrics:newShadowView.layoutMetrics oldLayoutMetrics:oldShadowView.layoutMetrics];
}
// `Update LocalData` instruction
static void RNUpdateLocalDataMountInstruction(ShadowViewMutation const &mutation, RCTComponentViewRegistry *registry)
static void RNUpdateLocalDataMountInstruction(ShadowViewMutation const &mutation, RNComponentViewRegistry *registry)
{
auto const &oldShadowView = mutation.oldChildShadowView;
auto const &newShadowView = mutation.newChildShadowView;
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
UIView<RNComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
[componentView updateLocalData:newShadowView.localData oldLocalData:oldShadowView.localData];
}
// `Update State` instruction
static void RNUpdateStateMountInstruction(ShadowViewMutation const &mutation, RCTComponentViewRegistry *registry)
static void RNUpdateStateMountInstruction(ShadowViewMutation const &mutation, RNComponentViewRegistry *registry)
{
auto const &oldShadowView = mutation.oldChildShadowView;
auto const &newShadowView = mutation.newChildShadowView;
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
UIView<RNComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
[componentView updateState:newShadowView.state oldState:oldShadowView.state];
}
@ -123,15 +121,15 @@ static void RNUpdateStateMountInstruction(ShadowViewMutation const &mutation, RC
static void RNFinalizeUpdatesMountInstruction(
ShadowViewMutation const &mutation,
RNComponentViewUpdateMask mask,
RCTComponentViewRegistry *registry)
RNComponentViewRegistry *registry)
{
auto const &newShadowView = mutation.newChildShadowView;
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
UIView<RNComponentViewProtocol> *componentView = [registry componentViewByTag:newShadowView.tag];
[componentView finalizeUpdates:mask];
}
// `Update` instruction
static void RNPerformMountInstructions(ShadowViewMutationList const &mutations, RCTComponentViewRegistry *registry)
static void RNPerformMountInstructions(ShadowViewMutationList const &mutations, RNComponentViewRegistry *registry)
{
SystraceSection s("RNPerformMountInstructions");
@ -196,12 +194,12 @@ static void RNPerformMountInstructions(ShadowViewMutationList const &mutations,
}
}
@implementation RCTMountingManager
@implementation RNMountingManager
- (instancetype)init
{
if (self = [super init]) {
_componentViewRegistry = [[RCTComponentViewRegistry alloc] init];
_componentViewRegistry = [[RNComponentViewRegistry alloc] init];
}
return self;
@ -243,7 +241,7 @@ static void RNPerformMountInstructions(ShadowViewMutationList const &mutations,
- (void)mountMutations:(MountingCoordinator::Shared const &)mountingCoordinator
{
SystraceSection s("-[RCTMountingManager mountMutations:]");
SystraceSection s("-[RNMountingManager mountMutations:]");
auto transaction = mountingCoordinator->pullTransaction();
if (!transaction.has_value()) {
@ -263,7 +261,7 @@ static void RNPerformMountInstructions(ShadowViewMutationList const &mutations,
componentDescriptor:(const ComponentDescriptor &)componentDescriptor
{
RCTAssertMainQueue();
UIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry componentViewByTag:reactTag];
UIView<RNComponentViewProtocol> *componentView = [_componentViewRegistry componentViewByTag:reactTag];
SharedProps oldProps = [componentView props];
SharedProps newProps = componentDescriptor.cloneProps(oldProps, RawProps(convertIdToFollyDynamic(props)));
[componentView updateProps:newProps oldProps:oldProps];
@ -274,7 +272,7 @@ static void RNPerformMountInstructions(ShadowViewMutationList const &mutations,
args:(NSArray *)args
{
RCTAssertMainQueue();
UIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry componentViewByTag:reactTag];
UIView<RNComponentViewProtocol> *componentView = [_componentViewRegistry componentViewByTag:reactTag];
[componentView handleCommand:commandName args:args];
}

Просмотреть файл

@ -7,30 +7,30 @@
#import <UIKit/UIKit.h>
#import <React/RCTPrimitives.h>
#import <React/RNPrimitives.h>
NS_ASSUME_NONNULL_BEGIN
@class RCTMountingManager;
@class RNMountingManager;
/**
* MountingManager's delegate.
*/
@protocol RCTMountingManagerDelegate <NSObject>
@protocol RNMountingManagerDelegate <NSObject>
/*
* Called right *before* execution of mount items which affect a Surface with
* given `rootTag`.
* Always called on the main queue.
*/
- (void)mountingManager:(RCTMountingManager *)mountingManager willMountComponentsWithRootTag:(ReactTag)MountingManager;
- (void)mountingManager:(RNMountingManager *)mountingManager willMountComponentsWithRootTag:(ReactTag)MountingManager;
/*
* Called right *after* execution of mount items which affect a Surface with
* given `rootTag`.
* Always called on the main queue.
*/
- (void)mountingManager:(RCTMountingManager *)mountingManager didMountComponentsWithRootTag:(ReactTag)rootTag;
- (void)mountingManager:(RNMountingManager *)mountingManager didMountComponentsWithRootTag:(ReactTag)rootTag;
@end

Просмотреть файл

@ -7,20 +7,20 @@
#import <UIKit/UIKit.h>
#import <React/RCTComponentViewProtocol.h>
#import <React/RNComponentViewProtocol.h>
NS_ASSUME_NONNULL_BEGIN
/**
* Default implementation of RCTComponentViewProtocol.
* Default implementation of RNComponentViewProtocol.
*/
@interface UIView (ComponentViewProtocol) <RCTComponentViewProtocol>
@interface UIView (ComponentViewProtocol) <RNComponentViewProtocol>
+ (std::vector<facebook::react::ComponentDescriptorProvider>)supplementalComponentDescriptorProviders;
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
- (void)mountChildComponentView:(UIView<RNComponentViewProtocol> *)childComponentView index:(NSInteger)index;
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
- (void)unmountChildComponentView:(UIView<RNComponentViewProtocol> *)childComponentView index:(NSInteger)index;
- (void)updateProps:(facebook::react::Props::Shared const &)props
oldProps:(facebook::react::Props::Shared const &)oldProps;

Просмотреть файл

@ -11,7 +11,7 @@
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
#import "RCTConversions.h"
#import "RNConversions.h"
using namespace facebook::react;
@ -19,7 +19,7 @@ using namespace facebook::react;
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
RCTAssert(NO, @"`-[RCTComponentViewProtocol componentDescriptorProvider]` must be implemented in a concrete class.");
RCTAssert(NO, @"`-[RNComponentViewProtocol componentDescriptorProvider]` must be implemented in a concrete class.");
return {};
}
@ -28,12 +28,12 @@ using namespace facebook::react;
return {};
}
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
- (void)mountChildComponentView:(UIView<RNComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
[self insertSubview:childComponentView atIndex:index];
}
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
- (void)unmountChildComponentView:(UIView<RNComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
RCTAssert(childComponentView.superview == self, @"Attempt to unmount improperly mounted component view.");
[childComponentView removeFromSuperview];
@ -115,7 +115,7 @@ using namespace facebook::react;
- (facebook::react::SharedProps)props
{
RCTAssert(NO, @"props access should be implemented by RCTViewComponentView.");
RCTAssert(NO, @"props access should be implemented by RNViewComponentView.");
return nullptr;
}

Просмотреть файл

@ -1,32 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#import "RCTImageResponseDelegate.h"
#import "RCTImageResponseDelegate.h"
#include <react/imagemanager/ImageResponseObserver.h>
NS_ASSUME_NONNULL_BEGIN
namespace facebook {
namespace react {
class RCTImageResponseObserverProxy: public ImageResponseObserver {
public:
RCTImageResponseObserverProxy(void* delegate);
void didReceiveImage(const ImageResponse &imageResponse) override;
void didReceiveProgress (float p) override;
void didReceiveFailure() override;
private:
__weak id<RCTImageResponseDelegate> delegate_;
};
}
}
NS_ASSUME_NONNULL_END

Просмотреть файл

Просмотреть файл

@ -9,7 +9,7 @@
NS_ASSUME_NONNULL_BEGIN
@protocol RCTImageResponseDelegate <NSObject>
@protocol RNImageResponseDelegate <NSObject>
- (void)didReceiveImage:(UIImage *)image fromObserver:(void*)observer;
- (void)didReceiveProgress:(float)progress fromObserver:(void*)observer;

Просмотреть файл

@ -0,0 +1,31 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#import "RNImageResponseDelegate.h"
#include <react/imagemanager/ImageResponseObserver.h>
NS_ASSUME_NONNULL_BEGIN
namespace facebook {
namespace react {
class RNImageResponseObserverProxy : public ImageResponseObserver {
public:
RNImageResponseObserverProxy(void *delegate);
void didReceiveImage(const ImageResponse &imageResponse) override;
void didReceiveProgress(float p) override;
void didReceiveFailure() override;
private:
__weak id<RNImageResponseDelegate> delegate_;
};
} // namespace react
} // namespace facebook
NS_ASSUME_NONNULL_END

Просмотреть файл

@ -5,17 +5,21 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTImageResponseObserverProxy.h"
#import "RNImageResponseObserverProxy.h"
#import <react/imagemanager/ImageResponseObserver.h>
#import <react/imagemanager/ImageResponse.h>
#import <react/imagemanager/ImageResponseObserver.h>
namespace facebook {
namespace react {
namespace react {
RCTImageResponseObserverProxy::RCTImageResponseObserverProxy(void* delegate): delegate_((__bridge id<RCTImageResponseDelegate>)delegate) {}
RNImageResponseObserverProxy::RNImageResponseObserverProxy(void *delegate)
: delegate_((__bridge id<RNImageResponseDelegate>)delegate)
{
}
void RCTImageResponseObserverProxy::didReceiveImage(const ImageResponse &imageResponse) {
void RNImageResponseObserverProxy::didReceiveImage(const ImageResponse &imageResponse)
{
UIImage *image = (__bridge UIImage *)imageResponse.getImage().get();
void *this_ = this;
dispatch_async(dispatch_get_main_queue(), ^{
@ -23,19 +27,21 @@ void RCTImageResponseObserverProxy::didReceiveImage(const ImageResponse &imageRe
});
}
void RCTImageResponseObserverProxy::didReceiveProgress (float p) {
void RNImageResponseObserverProxy::didReceiveProgress(float p)
{
void *this_ = this;
dispatch_async(dispatch_get_main_queue(), ^{
[delegate_ didReceiveProgress:p fromObserver:this_];
});
}
void RCTImageResponseObserverProxy::didReceiveFailure() {
void RNImageResponseObserverProxy::didReceiveFailure()
{
void *this_ = this;
dispatch_async(dispatch_get_main_queue(), ^{
[delegate_ didReceiveFailureFromObserver:this_];
});
}
} // namespace react
} // namespace react
} // namespace facebook

Просмотреть файл

Просмотреть файл

@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
#import <memory>
#import <React/RCTPrimitives.h>
#import <React/RNPrimitives.h>
#import <react/core/ComponentDescriptor.h>
#import <react/core/LayoutConstraints.h>
#import <react/core/LayoutContext.h>
@ -19,12 +19,12 @@
NS_ASSUME_NONNULL_BEGIN
@class RCTMountingManager;
@class RNMountingManager;
/**
* Exactly same semantic as `facebook::react::SchedulerDelegate`.
*/
@protocol RCTSchedulerDelegate
@protocol RNSchedulerDelegate
- (void)schedulerDidFinishTransaction:(facebook::react::MountingCoordinator::Shared const &)mountingCoordinator;
@ -37,9 +37,9 @@ NS_ASSUME_NONNULL_BEGIN
/**
* `facebook::react::Scheduler` as an Objective-C class.
*/
@interface RCTScheduler : NSObject
@interface RNScheduler : NSObject
@property (atomic, weak, nullable) id<RCTSchedulerDelegate> delegate;
@property (atomic, weak, nullable) id<RNSchedulerDelegate> delegate;
- (instancetype)initWithToolbox:(facebook::react::SchedulerToolbox)toolbox;

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTScheduler.h"
#import "RNScheduler.h"
#import <react/debug/SystraceSection.h>
#import <react/uimanager/ComponentDescriptorFactory.h>
@ -14,7 +14,7 @@
#import <React/RCTFollyConvert.h>
#import "RCTConversions.h"
#import "RNConversions.h"
using namespace facebook::react;
@ -24,7 +24,7 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
void schedulerDidFinishTransaction(MountingCoordinator::Shared const &mountingCoordinator) override
{
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
RNScheduler *scheduler = (__bridge RNScheduler *)scheduler_;
[scheduler.delegate schedulerDidFinishTransaction:mountingCoordinator];
}
@ -39,7 +39,7 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
const std::string &commandName,
const folly::dynamic args) override
{
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
RNScheduler *scheduler = (__bridge RNScheduler *)scheduler_;
[scheduler.delegate schedulerDidDispatchCommand:shadowView commandName:commandName args:args];
}
@ -47,7 +47,7 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
void *scheduler_;
};
@implementation RCTScheduler {
@implementation RNScheduler {
std::shared_ptr<Scheduler> _scheduler;
std::shared_ptr<SchedulerDelegateProxy> _delegateProxy;
}
@ -73,7 +73,7 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
layoutConstraints:(LayoutConstraints)layoutConstraints
layoutContext:(LayoutContext)layoutContext;
{
SystraceSection s("-[RCTScheduler startSurfaceWithSurfaceId:...]");
SystraceSection s("-[RNScheduler startSurfaceWithSurfaceId:...]");
auto props = convertIdToFollyDynamic(initialProps);
_scheduler->startSurface(surfaceId, RCTStringFromNSString(moduleName), props, layoutConstraints, layoutContext);
@ -83,7 +83,7 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
- (void)stopSurfaceWithSurfaceId:(SurfaceId)surfaceId
{
SystraceSection s("-[RCTScheduler stopSurfaceWithSurfaceId:]");
SystraceSection s("-[RNScheduler stopSurfaceWithSurfaceId:]");
_scheduler->stopSurface(surfaceId);
}
@ -91,7 +91,7 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
layoutContext:(LayoutContext)layoutContext
surfaceId:(SurfaceId)surfaceId
{
SystraceSection s("-[RCTScheduler measureSurfaceWithLayoutConstraints:]");
SystraceSection s("-[RNScheduler measureSurfaceWithLayoutConstraints:]");
return RCTCGSizeFromSize(_scheduler->measureSurface(surfaceId, layoutConstraints, layoutContext));
}
@ -99,7 +99,7 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
layoutContext:(LayoutContext)layoutContext
surfaceId:(SurfaceId)surfaceId
{
SystraceSection s("-[RCTScheduler constraintSurfaceLayoutWithLayoutConstraints:]");
SystraceSection s("-[RNScheduler constraintSurfaceLayoutWithLayoutConstraints:]");
_scheduler->constraintSurfaceLayout(surfaceId, layoutConstraints, layoutContext);
}

Просмотреть файл

@ -9,16 +9,16 @@
#import <memory>
#import <React/RCTBridge.h>
#import <React/RCTComponentViewFactory.h>
#import <React/RCTPrimitives.h>
#import <React/RCTSurfacePresenterStub.h>
#import <React/RNComponentViewFactory.h>
#import <React/RNPrimitives.h>
#import <React/RNSurfacePresenterStub.h>
#import <react/config/ReactNativeConfig.h>
#import <react/utils/ContextContainer.h>
NS_ASSUME_NONNULL_BEGIN
@class RCTFabricSurface;
@class RCTMountingManager;
@class RNFabricSurface;
@class RNMountingManager;
/**
* Coordinates presenting of React Native Surfaces and represents application
@ -26,52 +26,49 @@ NS_ASSUME_NONNULL_BEGIN
* SurfacePresenter incapsulates a bridge object inside and discourage direct
* access to it.
*/
@interface RCTSurfacePresenter : NSObject
@interface RNSurfacePresenter : NSObject
- (instancetype)initWithBridge:(RCTBridge *)bridge
config:(std::shared_ptr<const facebook::react::ReactNativeConfig>)config;
@property (nonatomic, readonly) RCTComponentViewFactory *componentViewFactory;
@property (nonatomic, readonly) RNComponentViewFactory *componentViewFactory;
@property (nonatomic, readonly) facebook::react::ContextContainer::Shared contextContainer;
@end
@interface RCTSurfacePresenter (Surface) <RCTSurfacePresenterStub>
@interface RNSurfacePresenter (Surface) <RNSurfacePresenterStub>
/**
* Surface uses these methods to register itself in the Presenter.
*/
- (void)registerSurface:(RCTFabricSurface *)surface;
- (void)registerSurface:(RNFabricSurface *)surface;
/**
* Starting initiates running, rendering and mounting processes.
* Should be called after registerSurface and any other surface-specific setup is done
*/
- (void)startSurface:(RCTFabricSurface *)surface;
- (void)unregisterSurface:(RCTFabricSurface *)surface;
- (void)setProps:(NSDictionary *)props
surface:(RCTFabricSurface *)surface;
- (void)startSurface:(RNFabricSurface *)surface;
- (void)unregisterSurface:(RNFabricSurface *)surface;
- (void)setProps:(NSDictionary *)props surface:(RNFabricSurface *)surface;
- (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
- (nullable RNFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
/**
* Measures the Surface with given constraints.
*/
- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize
maximumSize:(CGSize)maximumSize
surface:(RCTFabricSurface *)surface;
surface:(RNFabricSurface *)surface;
/**
* Sets `minimumSize` and `maximumSize` layout constraints for the Surface.
*/
- (void)setMinimumSize:(CGSize)minimumSize
maximumSize:(CGSize)maximumSize
surface:(RCTFabricSurface *)surface;
- (void)setMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize surface:(RNFabricSurface *)surface;
- (BOOL)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag props:(NSDictionary *)props;
- (void)addObserver:(id<RCTSurfacePresenterObserver>)observer;
- (void)addObserver:(id<RNSurfacePresenterObserver>)observer;
- (void)removeObserver:(id<RCTSurfacePresenterObserver>)observer;
- (void)removeObserver:(id<RNSurfacePresenterObserver>)observer;
@end

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTSurfacePresenter.h"
#import "RNSurfacePresenter.h"
#import <cxxreact/MessageQueueThread.h>
#import <jsi/jsi.h>
@ -14,18 +14,18 @@
#import <React/RCTAssert.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTComponentViewFactory.h>
#import <React/RCTComponentViewRegistry.h>
#import <React/RCTFabricSurface.h>
#import <React/RCTFollyConvert.h>
#import <React/RCTImageLoader.h>
#import <React/RCTMountingManager.h>
#import <React/RCTMountingManagerDelegate.h>
#import <React/RCTScheduler.h>
#import <React/RCTSurfaceRegistry.h>
#import <React/RCTSurfaceView+Internal.h>
#import <React/RCTSurfaceView.h>
#import <React/RCTUtils.h>
#import <React/RNComponentViewFactory.h>
#import <React/RNComponentViewRegistry.h>
#import <React/RNFabricSurface.h>
#import <React/RNMountingManager.h>
#import <React/RNMountingManagerDelegate.h>
#import <React/RNScheduler.h>
#import <React/RNSurfaceRegistry.h>
#import <react/components/root/RootShadowNode.h>
#import <react/core/LayoutConstraints.h>
@ -37,7 +37,7 @@
#import <react/utils/RuntimeExecutor.h>
#import "MainRunLoopEventBeat.h"
#import "RCTConversions.h"
#import "RNConversions.h"
#import "RuntimeEventBeat.h"
using namespace facebook::react;
@ -47,21 +47,21 @@ using namespace facebook::react;
- (void)invokeAsync:(std::function<void()> &&)func;
@end
@interface RCTSurfacePresenter () <RCTSchedulerDelegate, RCTMountingManagerDelegate>
@interface RNSurfacePresenter () <RNSchedulerDelegate, RNMountingManagerDelegate>
@end
@implementation RCTSurfacePresenter {
@implementation RNSurfacePresenter {
std::mutex _schedulerMutex;
std::mutex _contextContainerMutex;
RCTScheduler
RNScheduler
*_Nullable _scheduler; // Thread-safe. Mutation of the instance variable is protected by `_schedulerMutex`.
RCTMountingManager *_mountingManager; // Thread-safe.
RCTSurfaceRegistry *_surfaceRegistry; // Thread-safe.
RNMountingManager *_mountingManager; // Thread-safe.
RNSurfaceRegistry *_surfaceRegistry; // Thread-safe.
RCTBridge *_bridge; // Unsafe. We are moving away from Bridge.
RCTBridge *_batchedBridge;
std::shared_ptr<const ReactNativeConfig> _reactNativeConfig;
better::shared_mutex _observerListMutex;
NSMutableArray<id<RCTSurfacePresenterObserver>> *_observers;
NSMutableArray<id<RNSurfacePresenterObserver>> *_observers;
}
- (instancetype)initWithBridge:(RCTBridge *)bridge config:(std::shared_ptr<const ReactNativeConfig>)config
@ -71,9 +71,9 @@ using namespace facebook::react;
_batchedBridge = [_bridge batchedBridge] ?: _bridge;
[_batchedBridge setSurfacePresenter:self];
_surfaceRegistry = [[RCTSurfaceRegistry alloc] init];
_surfaceRegistry = [[RNSurfaceRegistry alloc] init];
_mountingManager = [[RCTMountingManager alloc] init];
_mountingManager = [[RNMountingManager alloc] init];
_mountingManager.delegate = self;
if (config != nullptr) {
@ -102,44 +102,42 @@ using namespace facebook::react;
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (RCTComponentViewFactory *)componentViewFactory
- (RNComponentViewFactory *)componentViewFactory
{
return _mountingManager.componentViewRegistry.componentViewFactory;
}
#pragma mark - Internal Surface-dedicated Interface
- (void)registerSurface:(RCTFabricSurface *)surface
- (void)registerSurface:(RNFabricSurface *)surface
{
[_surfaceRegistry registerSurface:surface];
}
- (void)startSurface:(RCTFabricSurface *)surface
- (void)startSurface:(RNFabricSurface *)surface
{
[self _startSurface:surface];
}
- (void)unregisterSurface:(RCTFabricSurface *)surface
- (void)unregisterSurface:(RNFabricSurface *)surface
{
[self _stopSurface:surface];
[_surfaceRegistry unregisterSurface:surface];
}
- (void)setProps:(NSDictionary *)props surface:(RCTFabricSurface *)surface
- (void)setProps:(NSDictionary *)props surface:(RNFabricSurface *)surface
{
// This implementation is suboptimal indeed but still better than nothing for now.
[self _stopSurface:surface];
[self _startSurface:surface];
}
- (RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag
- (RNFabricSurface *)surfaceForRootTag:(ReactTag)rootTag
{
return [_surfaceRegistry surfaceForRootTag:rootTag];
}
- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize
maximumSize:(CGSize)maximumSize
surface:(RCTFabricSurface *)surface
- (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize surface:(RNFabricSurface *)surface
{
LayoutContext layoutContext = {.pointScaleFactor = RCTScreenScale()};
@ -151,7 +149,7 @@ using namespace facebook::react;
surfaceId:surface.rootTag];
}
- (void)setMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize surface:(RCTFabricSurface *)surface
- (void)setMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximumSize surface:(RNFabricSurface *)surface
{
LayoutContext layoutContext = {.pointScaleFactor = RCTScreenScale()};
@ -166,7 +164,7 @@ using namespace facebook::react;
- (BOOL)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag props:(NSDictionary *)props
{
ReactTag tag = [reactTag integerValue];
UIView<RCTComponentViewProtocol> *componentView = [_mountingManager.componentViewRegistry componentViewByTag:tag];
UIView<RNComponentViewProtocol> *componentView = [_mountingManager.componentViewRegistry componentViewByTag:tag];
if (componentView == nil) {
return NO; // This view probably isn't managed by Fabric
}
@ -180,7 +178,7 @@ using namespace facebook::react;
#pragma mark - Private
- (RCTScheduler *)_scheduler
- (RNScheduler *)_scheduler
{
std::lock_guard<std::mutex> lock(_schedulerMutex);
@ -191,7 +189,7 @@ using namespace facebook::react;
auto componentRegistryFactory = [factory = wrapManagedObject(self.componentViewFactory)](
EventDispatcher::Shared const &eventDispatcher,
ContextContainer::Shared const &contextContainer) {
return [(RCTComponentViewFactory *)unwrapManagedObject(factory)
return [(RNComponentViewFactory *)unwrapManagedObject(factory)
createComponentDescriptorRegistryWithParameters:{eventDispatcher, contextContainer}];
};
@ -210,7 +208,7 @@ using namespace facebook::react;
return std::make_unique<RuntimeEventBeat>(runtimeExecutor);
};
_scheduler = [[RCTScheduler alloc] initWithToolbox:toolbox];
_scheduler = [[RNScheduler alloc] initWithToolbox:toolbox];
_scheduler.delegate = self;
return _scheduler;
@ -257,9 +255,9 @@ using namespace facebook::react;
return _contextContainer;
}
- (void)_startSurface:(RCTFabricSurface *)surface
- (void)_startSurface:(RNFabricSurface *)surface
{
RCTMountingManager *mountingManager = _mountingManager;
RNMountingManager *mountingManager = _mountingManager;
RCTExecuteOnMainQueue(^{
[mountingManager.componentViewRegistry dequeueComponentViewWithComponentHandle:RootShadowNode::Handle()
tag:surface.rootTag];
@ -277,13 +275,13 @@ using namespace facebook::react;
layoutContext:layoutContext];
}
- (void)_stopSurface:(RCTFabricSurface *)surface
- (void)_stopSurface:(RNFabricSurface *)surface
{
[self._scheduler stopSurfaceWithSurfaceId:surface.rootTag];
RCTMountingManager *mountingManager = _mountingManager;
RNMountingManager *mountingManager = _mountingManager;
RCTExecuteOnMainQueue(^{
UIView<RCTComponentViewProtocol> *rootView =
UIView<RNComponentViewProtocol> *rootView =
[mountingManager.componentViewRegistry componentViewByTag:surface.rootTag];
[mountingManager.componentViewRegistry enqueueComponentViewWithComponentHandle:RootShadowNode::Handle()
tag:surface.rootTag
@ -295,8 +293,8 @@ using namespace facebook::react;
- (void)_startAllSurfaces
{
[_surfaceRegistry enumerateWithBlock:^(NSEnumerator<RCTFabricSurface *> *enumerator) {
for (RCTFabricSurface *surface in enumerator) {
[_surfaceRegistry enumerateWithBlock:^(NSEnumerator<RNFabricSurface *> *enumerator) {
for (RNFabricSurface *surface in enumerator) {
[self _startSurface:surface];
}
}];
@ -304,18 +302,18 @@ using namespace facebook::react;
- (void)_stopAllSurfaces
{
[_surfaceRegistry enumerateWithBlock:^(NSEnumerator<RCTFabricSurface *> *enumerator) {
for (RCTFabricSurface *surface in enumerator) {
[_surfaceRegistry enumerateWithBlock:^(NSEnumerator<RNFabricSurface *> *enumerator) {
for (RNFabricSurface *surface in enumerator) {
[self _stopSurface:surface];
}
}];
}
#pragma mark - RCTSchedulerDelegate
#pragma mark - RNSchedulerDelegate
- (void)schedulerDidFinishTransaction:(facebook::react::MountingCoordinator::Shared const &)mountingCoordinator
{
RCTFabricSurface *surface = [_surfaceRegistry surfaceForRootTag:mountingCoordinator->getSurfaceId()];
RNFabricSurface *surface = [_surfaceRegistry surfaceForRootTag:mountingCoordinator->getSurfaceId()];
[surface _setStage:RCTSurfaceStagePrepared];
@ -333,37 +331,37 @@ using namespace facebook::react;
[self->_mountingManager dispatchCommand:tag commandName:commandStr args:argsArray];
}
- (void)addObserver:(id<RCTSurfacePresenterObserver>)observer
- (void)addObserver:(id<RNSurfacePresenterObserver>)observer
{
std::unique_lock<better::shared_mutex> lock(_observerListMutex);
[self->_observers addObject:observer];
}
- (void)removeObserver:(id<RCTSurfacePresenterObserver>)observer
- (void)removeObserver:(id<RNSurfacePresenterObserver>)observer
{
std::unique_lock<better::shared_mutex> lock(_observerListMutex);
[self->_observers removeObject:observer];
}
#pragma mark - RCTMountingManagerDelegate
#pragma mark - RNMountingManagerDelegate
- (void)mountingManager:(RCTMountingManager *)mountingManager willMountComponentsWithRootTag:(ReactTag)rootTag
- (void)mountingManager:(RNMountingManager *)mountingManager willMountComponentsWithRootTag:(ReactTag)rootTag
{
RCTAssertMainQueue();
std::shared_lock<better::shared_mutex> lock(_observerListMutex);
for (id<RCTSurfacePresenterObserver> observer in _observers) {
for (id<RNSurfacePresenterObserver> observer in _observers) {
if ([observer respondsToSelector:@selector(willMountComponentsWithRootTag:)]) {
[observer willMountComponentsWithRootTag:rootTag];
}
}
}
- (void)mountingManager:(RCTMountingManager *)mountingManager didMountComponentsWithRootTag:(ReactTag)rootTag
- (void)mountingManager:(RNMountingManager *)mountingManager didMountComponentsWithRootTag:(ReactTag)rootTag
{
RCTAssertMainQueue();
RCTFabricSurface *surface = [_surfaceRegistry surfaceForRootTag:rootTag];
RNFabricSurface *surface = [_surfaceRegistry surfaceForRootTag:rootTag];
RCTSurfaceStage stage = surface.stage;
if (stage & RCTSurfaceStagePrepared) {
// We have to progress the stage only if the preparing phase is done.
@ -374,7 +372,7 @@ using namespace facebook::react;
}
std::shared_lock<better::shared_mutex> lock(_observerListMutex);
for (id<RCTSurfacePresenterObserver> observer in _observers) {
for (id<RNSurfacePresenterObserver> observer in _observers) {
if ([observer respondsToSelector:@selector(didMountComponentsWithRootTag:)]) {
[observer didMountComponentsWithRootTag:rootTag];
}

Просмотреть файл

@ -7,13 +7,13 @@
#import <UIKit/UIKit.h>
#import <React/RCTPrimitives.h>
#import <React/RNPrimitives.h>
NS_ASSUME_NONNULL_BEGIN
@class RCTFabricSurface;
@class RNFabricSurface;
typedef void(^RCTSurfaceEnumeratorBlock)(NSEnumerator<RCTFabricSurface *> *enumerator);
typedef void (^RCTSurfaceEnumeratorBlock)(NSEnumerator<RNFabricSurface *> *enumerator);
/**
* Registry of Surfaces.
@ -21,7 +21,7 @@ typedef void(^RCTSurfaceEnumeratorBlock)(NSEnumerator<RCTFabricSurface *> *enume
* All methods of the registry are thread-safe.
* The registry stores Surface objects as weak references.
*/
@interface RCTSurfaceRegistry : NSObject
@interface RNSurfaceRegistry : NSObject
- (void)enumerateWithBlock:(RCTSurfaceEnumeratorBlock)block;
@ -29,18 +29,18 @@ typedef void(^RCTSurfaceEnumeratorBlock)(NSEnumerator<RCTFabricSurface *> *enume
* Adds Surface object into the registry.
* The registry does not retain Surface references.
*/
- (void)registerSurface:(RCTFabricSurface *)surface;
- (void)registerSurface:(RNFabricSurface *)surface;
/**
* Removes Surface object from the registry.
*/
- (void)unregisterSurface:(RCTFabricSurface *)surface;
- (void)unregisterSurface:(RNFabricSurface *)surface;
/**
* Returns stored Surface object by given root tag.
* If the registry does not have such Surface registered, returns `nil`.
*/
- (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
- (nullable RNFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
@end

Просмотреть файл

@ -5,19 +5,19 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTSurfaceRegistry.h"
#import "RNSurfaceRegistry.h"
#import <mutex>
#import <shared_mutex>
#import <better/mutex.h>
#import <React/RCTFabricSurface.h>
#import <React/RNFabricSurface.h>
using namespace facebook;
@implementation RCTSurfaceRegistry {
@implementation RNSurfaceRegistry {
better::shared_mutex _mutex;
NSMapTable<id, RCTFabricSurface *> *_registry;
NSMapTable<id, RNFabricSurface *> *_registry;
}
- (instancetype)init
@ -36,7 +36,7 @@ using namespace facebook;
block([_registry objectEnumerator]);
}
- (void)registerSurface:(RCTFabricSurface *)surface
- (void)registerSurface:(RNFabricSurface *)surface
{
std::unique_lock<better::shared_mutex> lock(_mutex);
@ -44,7 +44,7 @@ using namespace facebook;
[_registry setObject:surface forKey:(__bridge id)(void *)rootTag];
}
- (void)unregisterSurface:(RCTFabricSurface *)surface
- (void)unregisterSurface:(RNFabricSurface *)surface
{
std::unique_lock<better::shared_mutex> lock(_mutex);
@ -52,7 +52,7 @@ using namespace facebook;
[_registry removeObjectForKey:(__bridge id)(void *)rootTag];
}
- (RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag
- (RNFabricSurface *)surfaceForRootTag:(ReactTag)rootTag
{
std::shared_lock<better::shared_mutex> lock(_mutex);

Просмотреть файл

@ -9,7 +9,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface RCTSurfaceTouchHandler : UIGestureRecognizer
@interface RNSurfaceTouchHandler : UIGestureRecognizer
- (void)attachToView:(UIView *)view;
- (void)detachFromView:(UIView *)view;

Просмотреть файл

@ -5,14 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTSurfaceTouchHandler.h"
#import "RNSurfaceTouchHandler.h"
#import <UIKit/UIGestureRecognizerSubclass.h>
#import <React/RCTUtils.h>
#import <React/RCTViewComponentView.h>
#import <React/RNViewComponentView.h>
#import <UIKit/UIGestureRecognizerSubclass.h>
#import "RCTConversions.h"
#import "RCTTouchableComponentViewProtocol.h"
#import "RNConversions.h"
#import "RNTouchableComponentViewProtocol.h"
using namespace facebook::react;
@ -92,7 +92,8 @@ static ActiveTouch CreateTouchWithUITouch(UITouch *uiTouch, UIView *rootComponen
ActiveTouch activeTouch = {};
if ([componentView respondsToSelector:@selector(touchEventEmitterAtPoint:)]) {
activeTouch.eventEmitter = [(id<RCTTouchableComponentViewProtocol>)componentView touchEventEmitterAtPoint:[uiTouch locationInView:componentView]];
activeTouch.eventEmitter = [(id<RNTouchableComponentViewProtocol>)componentView
touchEventEmitterAtPoint:[uiTouch locationInView:componentView]];
activeTouch.touch.target = (Tag)componentView.tag;
}
@ -134,10 +135,10 @@ struct PointerHasher {
}
};
@interface RCTSurfaceTouchHandler () <UIGestureRecognizerDelegate>
@interface RNSurfaceTouchHandler () <UIGestureRecognizerDelegate>
@end
@implementation RCTSurfaceTouchHandler {
@implementation RNSurfaceTouchHandler {
std::unordered_map<
__unsafe_unretained UITouch *,
ActiveTouch,

Просмотреть файл

@ -8,6 +8,6 @@
#import <UIKit/UIKit.h>
#import <react/components/view/TouchEventEmitter.h>
@protocol RCTTouchableComponentViewProtocol <NSObject>
@protocol RNTouchableComponentViewProtocol <NSObject>
- (facebook::react::SharedTouchEventEmitter)touchEventEmitterAtPoint:(CGPoint)point;
@end

Просмотреть файл

@ -5,14 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/
#import <React/RCTPrimitives.h>
#import <React/RCTSurfaceStage.h>
#import <React/RNPrimitives.h>
NS_ASSUME_NONNULL_BEGIN
@class RCTBridge;
@class RCTSurfaceView;
@class RCTSurfacePresenter;
@class RNSurfacePresenter;
@protocol RCTSurfaceDelegate;
/**
@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
* * ability to create a UIView instance on demand (later);
* * ability to communicate the current stage of the surface granularly.
*/
@interface RCTFabricSurface : NSObject
@interface RNFabricSurface : NSObject
@property (atomic, readonly) RCTSurfaceStage stage;
@property (atomic, readonly) NSString *moduleName;
@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (atomic, copy, readwrite) NSDictionary *properties;
- (instancetype)initWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter
- (instancetype)initWithSurfacePresenter:(RNSurfacePresenter *)surfacePresenter
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties;
@ -128,7 +128,7 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface RCTFabricSurface (Internal)
@interface RNFabricSurface (Internal)
/**
* Sets and clears given stage flags (bitmask).
@ -139,7 +139,7 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface RCTFabricSurface (Deprecated)
@interface RNFabricSurface (Deprecated)
/**
* Deprecated. Use `initWithSurfacePresenter:moduleName:initialProperties` instead.

Просмотреть файл

@ -5,24 +5,24 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTFabricSurface.h"
#import "RNFabricSurface.h"
#import <mutex>
#import <React/RCTAssert.h>
#import <React/RCTSurfaceDelegate.h>
#import <React/RCTSurfaceRootView.h>
#import <React/RCTSurfaceTouchHandler.h>
#import <React/RCTSurfaceView+Internal.h>
#import <React/RCTSurfaceView.h>
#import <React/RCTUIManagerUtils.h>
#import <React/RCTUtils.h>
#import <React/RNSurfaceTouchHandler.h>
#import "RCTSurfacePresenter.h"
#import "RNSurfacePresenter.h"
@implementation RCTFabricSurface {
@implementation RNFabricSurface {
// Immutable
RCTSurfacePresenter *_surfacePresenter;
RNSurfacePresenter *_surfacePresenter;
NSString *_moduleName;
// Protected by the `_mutex`
@ -35,10 +35,10 @@
// The Main thread only
RCTSurfaceView *_Nullable _view;
RCTSurfaceTouchHandler *_Nullable _touchHandler;
RNSurfaceTouchHandler *_Nullable _touchHandler;
}
- (instancetype)initWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter
- (instancetype)initWithSurfacePresenter:(RNSurfacePresenter *)surfacePresenter
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
{
@ -52,7 +52,7 @@
// FIXME: Replace with `_maximumSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX);`.
_maximumSize = RCTScreenSize();
_touchHandler = [RCTSurfaceTouchHandler new];
_touchHandler = [RNSurfaceTouchHandler new];
_stage = RCTSurfaceStageSurfaceDidInitialize;

Просмотреть файл

@ -10,6 +10,6 @@
/**
* Fabric-compatible RCTSurfaceHostingProxyRootView implementation.
*/
@interface RCTFabricSurfaceHostingProxyRootView : RCTSurfaceHostingProxyRootView
@interface RNFabricSurfaceHostingProxyRootView : RCTSurfaceHostingProxyRootView
@end

Просмотреть файл

@ -5,17 +5,17 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTFabricSurfaceHostingProxyRootView.h"
#import "RNFabricSurfaceHostingProxyRootView.h"
#import "RCTFabricSurface.h"
#import "RNFabricSurface.h"
@implementation RCTFabricSurfaceHostingProxyRootView
@implementation RNFabricSurfaceHostingProxyRootView
+ (RCTSurface *)createSurfaceWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
{
return (RCTSurface *)[[RCTFabricSurface alloc] initWithBridge:bridge
return (RCTSurface *)[[RNFabricSurface alloc] initWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties];
}

Просмотреть файл

@ -10,6 +10,6 @@
/**
* Fabric-compatible RCTSurfaceHostingView implementation.
*/
@interface RCTFabricSurfaceHostingView : RCTSurfaceHostingView
@interface RNFabricSurfaceHostingView : RCTSurfaceHostingView
@end

Просмотреть файл

@ -5,19 +5,19 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTFabricSurfaceHostingView.h"
#import "RNFabricSurfaceHostingView.h"
#import <React/RCTSurface.h>
#import "RCTFabricSurface.h"
#import "RNFabricSurface.h"
@implementation RCTFabricSurfaceHostingView
@implementation RNFabricSurfaceHostingView
- (instancetype)initWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
{
RCTSurface *surface = (RCTSurface *)[[RCTFabricSurface alloc] initWithBridge:bridge
RCTSurface *surface = (RCTSurface *)[[RNFabricSurface alloc] initWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties];
[surface start];

Просмотреть файл

@ -11,12 +11,12 @@
NS_ASSUME_NONNULL_BEGIN
// TODO: Eventually this should go away and files should just include RCTSurfacePresenter.h, but
// TODO: Eventually this should go away and files should just include RNSurfacePresenter.h, but
// that pulls in all of fabric which doesn't compile in open source yet, so we mirror the protocol
// and duplicate the category here for now.
@protocol RCTSurfacePresenterObserver <NSObject>
@protocol RNSurfacePresenterObserver <NSObject>
@optional
@ -25,18 +25,18 @@ NS_ASSUME_NONNULL_BEGIN
@end
@protocol RCTSurfacePresenterStub <NSObject>
@protocol RNSurfacePresenterStub <NSObject>
- (BOOL)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag props:(NSDictionary *)props;
- (void)addObserver:(id<RCTSurfacePresenterObserver>)observer;
- (void)removeObserver:(id<RCTSurfacePresenterObserver>)observer;
- (void)addObserver:(id<RNSurfacePresenterObserver>)observer;
- (void)removeObserver:(id<RNSurfacePresenterObserver>)observer;
@end
@interface RCTBridge (RCTSurfacePresenterStub)
@interface RCTBridge (RNSurfacePresenterStub)
- (id<RCTSurfacePresenterStub>)surfacePresenter;
- (void)setSurfacePresenter:(id<RCTSurfacePresenterStub>)presenter;
- (id<RNSurfacePresenterStub>)surfacePresenter;
- (void)setSurfacePresenter:(id<RNSurfacePresenterStub>)presenter;
@end

Просмотреть файл

@ -5,16 +5,16 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTSurfacePresenterStub.h"
#import "RNSurfacePresenterStub.h"
@implementation RCTBridge (RCTSurfacePresenterStub)
@implementation RCTBridge (RNSurfacePresenterStub)
- (id<RCTSurfacePresenterStub>)surfacePresenter
- (id<RNSurfacePresenterStub>)surfacePresenter
{
return objc_getAssociatedObject(self, @selector(surfacePresenter));
}
- (void)setSurfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
- (void)setSurfacePresenter:(id<RNSurfacePresenterStub>)surfacePresenter
{
objc_setAssociatedObject(self, @selector(surfacePresenter), surfacePresenter, OBJC_ASSOCIATION_ASSIGN);
}

Просмотреть файл

@ -88,7 +88,7 @@ private:
@end
// TODO: Consolidate this extension with the one in RCTSurfacePresenter.
// TODO: Consolidate this extension with the one in RNSurfacePresenter.
@interface RCTBridge ()
- (std::weak_ptr<facebook::react::Instance>)reactInstance;