mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
added C++ setup for FabricUIManager
Reviewed By: shergin Differential Revision: D7077312 fbshipit-source-id: e284c151438eb4d1f67a8386580ab54e3dce7c17
This commit is contained in:
parent
d8bb990abc
commit
0ee03178a0
46
ReactCommon/fabric/BUCK
Normal file
46
ReactCommon/fabric/BUCK
Normal file
@ -0,0 +1,46 @@
|
||||
load("@xplat//configurations/buck/apple:flag_defs.bzl", "DEBUG_PREPROCESSOR_FLAGS")
|
||||
load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "rn_xplat_cxx_library", "APPLE_INSPECTOR_FLAGS")
|
||||
|
||||
CXX_LIBRARY_COMPILER_FLAGS = [
|
||||
"-std=c++14",
|
||||
"-Wall",
|
||||
]
|
||||
|
||||
APPLE_COMPILER_FLAGS = []
|
||||
|
||||
if not IS_OSS_BUILD:
|
||||
load("@xplat//configurations/buck/apple:flag_defs.bzl", "STATIC_LIBRARY_IOS_FLAGS", "flags")
|
||||
APPLE_COMPILER_FLAGS = flags.get_flag_value(STATIC_LIBRARY_IOS_FLAGS, 'compiler_flags')
|
||||
|
||||
rn_xplat_cxx_library(
|
||||
name = "fabric",
|
||||
srcs = glob(["**/*.cpp"]),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob(
|
||||
[
|
||||
("", "**/*.h"),
|
||||
],
|
||||
prefix = "fabric",
|
||||
),
|
||||
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
],
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = DEBUG_PREPROCESSOR_FLAGS + APPLE_INSPECTOR_FLAGS,
|
||||
force_static = True,
|
||||
preprocessor_flags = [
|
||||
"-DLOG_TAG=\"ReactNative\"",
|
||||
"-DWITH_FBSYSTRACE=1",
|
||||
],
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
deps = [
|
||||
"xplat//fbsystrace:fbsystrace",
|
||||
"xplat//folly:headers_only",
|
||||
"xplat//folly:memory",
|
||||
"xplat//folly:molly",
|
||||
"xplat//third-party/glog:glog",
|
||||
],
|
||||
)
|
46
ReactCommon/fabric/FabricUIManager.cpp
Normal file
46
ReactCommon/fabric/FabricUIManager.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#include "FabricUIManager.h"
|
||||
#include "ShadowNode.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
FabricUIManager::FabricUIManager() {}
|
||||
|
||||
ShadowNodeRef FabricUIManager::createNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle) {
|
||||
return std::make_shared<ShadowNode>(reactTag, viewName, rootTag, props, instanceHandle);
|
||||
}
|
||||
|
||||
ShadowNodeRef FabricUIManager::cloneNode(const ShadowNodeRef &node) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShadowNodeRef FabricUIManager::cloneNodeWithNewChildren(const ShadowNodeRef &node) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShadowNodeRef FabricUIManager::cloneNodeWithNewProps(const ShadowNodeRef &node, folly::dynamic props) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShadowNodeRef FabricUIManager::cloneNodeWithNewChildrenAndProps(const ShadowNodeRef &node, folly::dynamic newProps) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FabricUIManager::appendChild(const ShadowNodeRef &parentNode, const ShadowNodeRef &childNode) {
|
||||
}
|
||||
|
||||
ShadowNodeSetRef FabricUIManager::createChildSet(int rootTag) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FabricUIManager::appendChildToSet(const ShadowNodeSetRef &childSet, const ShadowNodeRef &childNode) {
|
||||
}
|
||||
|
||||
void FabricUIManager::completeRoot(int rootTag) {
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
|
34
ReactCommon/fabric/FabricUIManager.h
Normal file
34
ReactCommon/fabric/FabricUIManager.h
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <folly/dynamic.h>
|
||||
#include <folly/FBVector.h>
|
||||
#include <memory>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class ShadowNode;
|
||||
|
||||
typedef std::shared_ptr<const ShadowNode> ShadowNodeRef;
|
||||
typedef folly::fbvector<const ShadowNodeRef> ShadowNodeSet;
|
||||
typedef std::shared_ptr<const ShadowNodeSet> ShadowNodeSetRef;
|
||||
|
||||
class FabricUIManager {
|
||||
public:
|
||||
FabricUIManager();
|
||||
|
||||
ShadowNodeRef createNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle);
|
||||
ShadowNodeRef cloneNode(const ShadowNodeRef &node);
|
||||
ShadowNodeRef cloneNodeWithNewChildren(const ShadowNodeRef &node);
|
||||
ShadowNodeRef cloneNodeWithNewProps(const ShadowNodeRef &node, folly::dynamic props);
|
||||
ShadowNodeRef cloneNodeWithNewChildrenAndProps(const ShadowNodeRef &node, folly::dynamic newProps);
|
||||
void appendChild(const ShadowNodeRef &parentNode, const ShadowNodeRef &childNode);
|
||||
ShadowNodeSetRef createChildSet(int rootTag);
|
||||
void appendChildToSet(const ShadowNodeSetRef &childSet, const ShadowNodeRef &childNode);
|
||||
void completeRoot(int rootTag);
|
||||
};
|
||||
|
||||
}}
|
||||
|
15
ReactCommon/fabric/ShadowNode.cpp
Normal file
15
ReactCommon/fabric/ShadowNode.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#include "ShadowNode.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
ShadowNode::ShadowNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle) :
|
||||
reactTag_(reactTag),
|
||||
viewName_(viewName),
|
||||
rootTag_(rootTag),
|
||||
props_(props),
|
||||
instanceHandle_(instanceHandle) {}
|
||||
|
||||
}}
|
22
ReactCommon/fabric/ShadowNode.h
Normal file
22
ReactCommon/fabric/ShadowNode.h
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <folly/dynamic.h>
|
||||
#include <memory>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class ShadowNode {
|
||||
public:
|
||||
int reactTag_;
|
||||
std::string viewName_;
|
||||
int rootTag_;
|
||||
folly::dynamic props_;
|
||||
void *instanceHandle_;
|
||||
|
||||
ShadowNode(int reactTag, std::string viewName, int rootTag, folly::dynamic props, void *instanceHandle);
|
||||
};
|
||||
|
||||
}}
|
Loading…
x
Reference in New Issue
Block a user