Migrate ARTSurfaceView to fabric

Summary:
Migrates ARTSurfaceView to Fabric,

This diff only migrates the necessary minimum for RCTVideo component to work. Other ART components are
ARTNode, ARTGroup, ARTRenderable, ARTShape and ARTText.

Reviewed By: mdvacca

Differential Revision: D17181298

fbshipit-source-id: c2656bbcaefde25e37a9e05a64d2691bc2343b67
This commit is contained in:
Samuel Susla
2019-09-11 08:43:48 -07:00
committed by Facebook Github Bot
parent 9349313c99
commit c8ae58880d
8 changed files with 147 additions and 0 deletions
@@ -0,0 +1,15 @@
/**
* 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.
*/
namespace facebook {
namespace react {
extern const char RCTARTSurfaceViewComponentName[] = "ARTSurfaceView";
} // namespace react
} // namespace facebook
@@ -0,0 +1,28 @@
/**
* 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
#include <react/components/view/ConcreteViewShadowNode.h>
#include "RCTARTSurfaceViewProps.h"
namespace facebook {
namespace react {
extern const char RCTARTSurfaceViewComponentName[];
/*
* `ShadowNode` for <ARTSurfaceView> component.
*/
using RCTARTSurfaceShadowNode = ConcreteViewShadowNode<
RCTARTSurfaceViewComponentName,
RCTARTSurfaceViewProps,
ViewEventEmitter>;
} // namespace react
} // namespace facebook
@@ -0,0 +1,21 @@
/**
* 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
#include <react/core/ConcreteComponentDescriptor.h>
#include "RCTARTSurfaceShadowNode.h"
namespace facebook {
namespace react {
using RCTARTSurfaceComponentDescriptor =
ConcreteComponentDescriptor<RCTARTSurfaceShadowNode>;
} // namespace react
} // namespace facebook
@@ -0,0 +1,15 @@
/**
* 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.
*/
#import <React/RCTViewComponentView.h>
/**
* UIView class for root <ARTSurfaceView> component.
*/
@interface RCTARTSurfaceViewComponentView : RCTViewComponentView
@end
@@ -0,0 +1,28 @@
#import "RCTARTSurfaceViewComponentView.h"
#import <react/uimanager/ComponentDescriptorProvider.h>
#import "RCTARTSurfaceViewComponentDescriptor.h"
using namespace facebook::react;
@implementation RCTARTSurfaceViewComponentView {
}
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
static const auto defaultProps = std::make_shared<const RCTARTSurfaceViewProps>();
_props = defaultProps;
}
return self;
}
#pragma mark - RCTComponentViewProtocol
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
return concreteComponentDescriptorProvider<RCTARTSurfaceComponentDescriptor>();
}
@end
@@ -0,0 +1,16 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#include "RCTARTSurfaceViewProps.h"
#include <react/core/propsConversions.h>
namespace facebook {
namespace react {
RCTARTSurfaceViewProps::RCTARTSurfaceViewProps(
const RCTARTSurfaceViewProps &sourceProps,
const RawProps &rawProps)
: ViewProps(sourceProps, rawProps) {}
} // namespace react
} // namespace facebook
@@ -0,0 +1,22 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include <react/components/view/ViewProps.h>
namespace facebook {
namespace react {
class RCTARTSurfaceViewProps final : public ViewProps {
public:
RCTARTSurfaceViewProps() = default;
RCTARTSurfaceViewProps(
const RCTARTSurfaceViewProps &sourceProps,
const RawProps &rawProps);
#pragma mark - Props
};
} // namespace react
} // namespace facebook
@@ -14,6 +14,7 @@
#import <react/core/ReactPrimitives.h>
#import <react/uimanager/ComponentDescriptorProviderRegistry.h>
#import "RCTARTSurfaceViewComponentView.h"
#import "RCTActivityIndicatorViewComponentView.h"
#import "RCTImageComponentView.h"
#import "RCTModalHostViewComponentView.h"
@@ -49,6 +50,7 @@ using namespace facebook::react;
[componentViewFactory registerComponentViewClass:[RCTSwitchComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTUnimplementedNativeComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTModalHostViewComponentView class]];
[componentViewFactory registerComponentViewClass:[RCTARTSurfaceViewComponentView class]];
return componentViewFactory;
}