initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <memory>
#include <fabric/IFabricPlatformUIOperationManager.h>
@class RCTFabricPlatformUIOperationManager;
namespace facebook {
namespace react {
/**
* Connector class (from C++ to ObjC++) to allow FabricUIManager to invoke native UI operations/updates.
* UIKit-related impl doesn't live here, but this class gets passed to the FabricUIManager C++ impl directly.
*/
class RCTFabricPlatformUIOperationManagerConnector : public IFabricPlatformUIOperationManager {
public:
RCTFabricPlatformUIOperationManagerConnector();
~RCTFabricPlatformUIOperationManagerConnector();
void performUIOperation();
private:
void *self_;
RCTFabricPlatformUIOperationManager *manager_;
};
} // namespace react
} // namespace facebook
/**
* Actual ObjC++ implementation of the UI operations.
*/
@interface RCTFabricPlatformUIOperationManager : NSObject
- (void)performUIOperation;
@end

View File

@@ -0,0 +1,48 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTFabricPlatformUIOperationManager.h"
namespace facebook {
namespace react {
RCTFabricPlatformUIOperationManagerConnector::RCTFabricPlatformUIOperationManagerConnector() {
self_ = (__bridge_retained void *)[RCTFabricPlatformUIOperationManager new];
manager_ = (__bridge RCTFabricPlatformUIOperationManager *)self_;
}
RCTFabricPlatformUIOperationManagerConnector::~RCTFabricPlatformUIOperationManagerConnector() {
CFRelease(self_);
self_ = NULL;
manager_ = NULL;
}
void RCTFabricPlatformUIOperationManagerConnector::performUIOperation() {
[manager_ performUIOperation];
}
} // namespace react
} // namespace facebook
// -----------------------------------------------------------------------------
// Start of ObjC++ impl
// Access UIKit here.
// -----------------------------------------------------------------------------
@implementation RCTFabricPlatformUIOperationManager
- (void)dealloc
{
NSLog(@"RCTFabricPlatformUIOperationManager: dealloc()");
}
- (void)performUIOperation
{
// TODO
NSLog(@"RCTFabricPlatformUIOperationManager: performUIOperation()");
}
@end

View File

@@ -0,0 +1,44 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <memory>
#import <React/RCTBridge.h>
#import <React/RCTInvalidating.h>
#import <React/RCTShadowView.h>
namespace facebook {
namespace react {
class FabricUIManager;
} // namespace react
} // namespace facebook
using namespace facebook::react;
/**
* An ObjC++ wrapper around the C++ FabricUIManager instance, so that the RCTCxxBridge can access it as needed.
*/
@interface RCTFabricUIManagerWrapper : NSObject <RCTInvalidating>
- (std::shared_ptr<FabricUIManager>)manager;
@end
@interface RCTBridge (RCTFabricUIManagerWrapper)
/**
* To access via the bridge:
*
* std::shared_ptr<FabricUIManager> fabricUIManager = [_bridge fabricUIManager];
*/
- (std::shared_ptr<FabricUIManager>)fabricUIManager;
@end

View File

@@ -0,0 +1,53 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTFabricUIManagerWrapper.h"
#include <fabric/FabricUIManager.h>
#import "RCTFabricPlatformUIOperationManager.h"
// This file contains experimental placeholders, nothing is finalized.
@implementation RCTFabricUIManagerWrapper
{
std::shared_ptr<FabricUIManager> _manager;
std::shared_ptr<IFabricPlatformUIOperationManager> _platformUIOperationManager;
}
- (instancetype)init
{
self = [super init];
if (self) {
_platformUIOperationManager = std::make_shared<RCTFabricPlatformUIOperationManagerConnector>();
_manager = std::make_shared<FabricUIManager>(_platformUIOperationManager);
}
return self;
}
- (std::shared_ptr<FabricUIManager>)manager
{
return _manager;
}
- (void)invalidate
{
}
@end
@implementation RCTBridge (RCTFabricUIManagerWrapper)
- (std::shared_ptr<FabricUIManager>)fabricUIManager
{
RCTFabricUIManagerWrapper *wrapper = [self jsBoundExtraModuleForClass:[RCTFabricUIManagerWrapper class]];
if (wrapper) {
return [wrapper manager];
}
return nullptr;
}
@end

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <React/RCTSurface.h>
/**
* Fabric-compatible RCTSurface implementation.
* It may not continue extending from RCTSurface in the future.
*/
@interface RCTFabricSurface : RCTSurface
@end

View File

@@ -0,0 +1,22 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTFabricSurface.h"
#import <React/RCTBridge.h>
@implementation RCTFabricSurface
- (void)unmountReactComponentWithBridge:(RCTBridge *)bridge rootViewTag:(NSNumber *)rootViewTag
{
[bridge enqueueJSCall:@"ReactFabric"
method:@"unmountComponentAtNodeAndRemoveContainer"
args:@[rootViewTag]
completion:NULL];
}
@end

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <React/RCTSurfaceHostingProxyRootView.h>
/**
* Fabric-compatible RCTSurfaceHostingProxyRootView implementation.
*/
@interface RCTFabricSurfaceHostingProxyRootView : RCTSurfaceHostingProxyRootView
@end

View File

@@ -0,0 +1,19 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTFabricSurfaceHostingProxyRootView.h"
#import "RCTFabricSurface.h"
@implementation RCTFabricSurfaceHostingProxyRootView
- (RCTSurface *)createSurfaceWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName initialProperties:(NSDictionary *)initialProperties
{
return [[RCTFabricSurface alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
}
@end

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <React/RCTSurfaceHostingView.h>
/**
* Fabric-compatible RCTSurfaceHostingView implementation.
*/
@interface RCTFabricSurfaceHostingView : RCTSurfaceHostingView
@end

View File

@@ -0,0 +1,25 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTFabricSurfaceHostingView.h"
#import "RCTFabricSurface.h"
@implementation RCTFabricSurfaceHostingView
- (instancetype)initWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
{
RCTFabricSurface *surface = [[RCTFabricSurface alloc] initWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties];
return [self initWithSurface:surface];
}
@end