mirror of
https://github.com/status-im/react-native.git
synced 2025-01-26 09:19:10 +00:00
Fabric: ScrollView: primitives and buck target
Summary: Trivial. Reviewed By: fkgozali Differential Revision: D7961870 fbshipit-source-id: 3cfd92bd441dbf516ade777e6428924e9634257a
This commit is contained in:
parent
b805172034
commit
e3a3999b75
@ -171,6 +171,15 @@ Pod::Spec.new do |s|
|
||||
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
|
||||
end
|
||||
|
||||
ss.subspec "scrollview" do |sss|
|
||||
sss.dependency "Folly", folly_version
|
||||
sss.compiler_flags = folly_compiler_flags
|
||||
sss.source_files = "ReactCommon/fabric/scrollview/**/*.{cpp,h}"
|
||||
sss.exclude_files = "**/tests/*"
|
||||
sss.header_dir = "fabric/scrollview"
|
||||
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
|
||||
end
|
||||
|
||||
ss.subspec "text" do |sss|
|
||||
sss.dependency "Folly", folly_version
|
||||
sss.compiler_flags = folly_compiler_flags
|
||||
|
81
ReactCommon/fabric/scrollview/BUCK
Normal file
81
ReactCommon/fabric/scrollview/BUCK
Normal file
@ -0,0 +1,81 @@
|
||||
load("//configurations/buck/apple:flag_defs.bzl", "get_application_ios_flags", "get_debug_preprocessor_flags", "OBJC_ARC_PREPROCESSOR_FLAGS")
|
||||
load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "rn_xplat_cxx_library", "get_apple_inspector_flags", "react_native_xplat_target", "ANDROID", "APPLE")
|
||||
|
||||
APPLE_COMPILER_FLAGS = []
|
||||
|
||||
if not IS_OSS_BUILD:
|
||||
load("@xplat//configurations/buck/apple:flag_defs.bzl", "get_static_library_ios_flags", "flags")
|
||||
APPLE_COMPILER_FLAGS = flags.get_flag_value(get_static_library_ios_flags(), 'compiler_flags')
|
||||
|
||||
rn_xplat_cxx_library(
|
||||
name = "scrollview",
|
||||
srcs = glob(
|
||||
["**/*.cpp"],
|
||||
excludes = glob(["tests/**/*.cpp"]),
|
||||
),
|
||||
headers = glob(
|
||||
["**/*.h"],
|
||||
excludes = glob(["tests/**/*.h"]),
|
||||
),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob(
|
||||
[
|
||||
("", "*.h"),
|
||||
],
|
||||
prefix = "fabric/scrollview",
|
||||
),
|
||||
compiler_flags = [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
"-std=c++14",
|
||||
"-Wall",
|
||||
],
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(),
|
||||
fbobjc_tests = [
|
||||
":tests",
|
||||
],
|
||||
force_static = True,
|
||||
macosx_tests_override = [],
|
||||
platforms = (ANDROID, APPLE),
|
||||
preprocessor_flags = [
|
||||
"-DLOG_TAG=\"ReactNative\"",
|
||||
"-DWITH_FBSYSTRACE=1",
|
||||
],
|
||||
tests = [],
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
"xplat//fbsystrace:fbsystrace",
|
||||
"xplat//folly:headers_only",
|
||||
"xplat//folly:memory",
|
||||
"xplat//folly:molly",
|
||||
"xplat//third-party/glog:glog",
|
||||
"xplat//yoga:yoga",
|
||||
react_native_xplat_target("fabric/debug:debug"),
|
||||
react_native_xplat_target("fabric/core:core"),
|
||||
react_native_xplat_target("fabric/graphics:graphics"),
|
||||
react_native_xplat_target("fabric/view:view"),
|
||||
],
|
||||
)
|
||||
|
||||
if not IS_OSS_BUILD:
|
||||
load("@xplat//build_defs:fb_xplat_cxx_test.bzl", "fb_xplat_cxx_test")
|
||||
|
||||
fb_xplat_cxx_test(
|
||||
name = "tests",
|
||||
srcs = glob(["tests/**/*.cpp"]),
|
||||
headers = glob(["tests/**/*.h"]),
|
||||
contacts = ["oncall+react_native@xmail.facebook.com"],
|
||||
compiler_flags = [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
"-std=c++14",
|
||||
"-Wall",
|
||||
],
|
||||
platforms = APPLE,
|
||||
deps = [
|
||||
"xplat//folly:molly",
|
||||
"xplat//third-party/gmock:gtest",
|
||||
":scrollview",
|
||||
],
|
||||
)
|
65
ReactCommon/fabric/scrollview/conversions.h
Normal file
65
ReactCommon/fabric/scrollview/conversions.h
Normal file
@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fabric/scrollview/primitives.h>
|
||||
#include <folly/dynamic.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
inline void fromDynamic(const folly::dynamic &value, ScrollViewSnapToAlignment &result) {
|
||||
auto string = value.asString();
|
||||
if (string == "start") { result = ScrollViewSnapToAlignment::Start; return; }
|
||||
if (string == "center") { result = ScrollViewSnapToAlignment::Center; return; }
|
||||
if (string == "end") { result = ScrollViewSnapToAlignment::End; return; }
|
||||
abort();
|
||||
}
|
||||
|
||||
inline void fromDynamic(const folly::dynamic &value, ScrollViewIndicatorStyle &result) {
|
||||
auto string = value.asString();
|
||||
if (string == "default") { result = ScrollViewIndicatorStyle::Default; return; }
|
||||
if (string == "black") { result = ScrollViewIndicatorStyle::Black; return; }
|
||||
if (string == "white") { result = ScrollViewIndicatorStyle::White; return; }
|
||||
abort();
|
||||
}
|
||||
|
||||
inline void fromDynamic(const folly::dynamic &value, ScrollViewKeyboardDismissMode &result) {
|
||||
auto string = value.asString();
|
||||
if (string == "none") { result = ScrollViewKeyboardDismissMode::None; return; }
|
||||
if (string == "on-drag") { result = ScrollViewKeyboardDismissMode::OnDrag; return; }
|
||||
if (string == "interactive") { result = ScrollViewKeyboardDismissMode::Interactive; return; }
|
||||
abort();
|
||||
}
|
||||
|
||||
inline std::string toString(const ScrollViewSnapToAlignment &value) {
|
||||
switch (value) {
|
||||
case ScrollViewSnapToAlignment::Start: return "start";
|
||||
case ScrollViewSnapToAlignment::Center: return "center";
|
||||
case ScrollViewSnapToAlignment::End: return "end";
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string toString(const ScrollViewIndicatorStyle &value) {
|
||||
switch (value) {
|
||||
case ScrollViewIndicatorStyle::Default: return "default";
|
||||
case ScrollViewIndicatorStyle::Black: return "black";
|
||||
case ScrollViewIndicatorStyle::White: return "white";
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string toString(const ScrollViewKeyboardDismissMode &value) {
|
||||
switch (value) {
|
||||
case ScrollViewKeyboardDismissMode::None: return "none";
|
||||
case ScrollViewKeyboardDismissMode::OnDrag: return "on-drag";
|
||||
case ScrollViewKeyboardDismissMode::Interactive: return "interactive";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
32
ReactCommon/fabric/scrollview/primitives.h
Normal file
32
ReactCommon/fabric/scrollview/primitives.h
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
enum class ScrollViewSnapToAlignment {
|
||||
Start,
|
||||
Center,
|
||||
End
|
||||
};
|
||||
|
||||
enum class ScrollViewIndicatorStyle {
|
||||
Default,
|
||||
Black,
|
||||
White
|
||||
};
|
||||
|
||||
enum class ScrollViewKeyboardDismissMode {
|
||||
None,
|
||||
OnDrag,
|
||||
Interactive
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
14
ReactCommon/fabric/scrollview/tests/ScrollViewTest.cpp
Normal file
14
ReactCommon/fabric/scrollview/tests/ScrollViewTest.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(ScrollViewTest, testSomething) {
|
||||
// TODO
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user