From 50af304b3fee0f167c6e340c21fa9adeb348e27b Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 18 Aug 2020 19:53:03 -0700 Subject: [PATCH] Integrate Fabric Text in RN Tester OSS Summary: This diff integrates Text component into RN OSS changelog: [internal] internal Reviewed By: fkgozali Differential Revision: D23177414 fbshipit-source-id: 0a415f8dd8339b84465a7c8d73f3d8abd80fbecc --- .../com/facebook/react/fabric/jni/Android.mk | 5 ++- .../java/com/facebook/react/fabric/jni/BUCK | 1 + .../fabric/jni/CoreComponentsRegistry.cpp | 10 ++++- .../react/renderer/components/text/Android.mk | 40 +++++++++++++++++++ .../renderer/textlayoutmanager/Android.mk | 4 +- 5 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 ReactCommon/react/renderer/components/text/Android.mk diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk index 906d02939e1..63160176ffc 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk @@ -11,7 +11,7 @@ LOCAL_MODULE := fabricjni LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) -LOCAL_SHARED_LIBRARIES := libreactconfig libyoga libglog libfb libfbjni libglog_init libfolly_json libfolly_futures libreact_render_mounting libreactnativeutilsjni libreact_utils libreact_render_debug libreact_render_graphics libreact_render_core libreact_render_mapbuffer react_render_componentregistry libreact_render_components_view libreact_render_components_view libreact_render_components_unimplementedview libreact_render_components_root libreact_render_components_scrollview libbetter libreact_render_attributedstring libreact_render_uimanager libreact_render_templateprocessor libreact_render_scheduler libreact_render_animations libreact_render_imagemanager libreact_render_textlayoutmanager libreact_render_viewmanagers +LOCAL_SHARED_LIBRARIES := libreactconfig libyoga libglog libfb libfbjni libglog_init libfolly_json libfolly_futures libreact_render_mounting libreactnativeutilsjni libreact_utils libreact_render_debug libreact_render_graphics libreact_render_core libreact_render_mapbuffer react_render_componentregistry libreact_render_components_view libreact_render_components_unimplementedview libreact_render_components_root libreact_render_components_scrollview libbetter libreact_render_attributedstring libreact_render_uimanager libreact_render_templateprocessor libreact_render_scheduler libreact_render_animations libreact_render_imagemanager libreact_render_textlayoutmanager libreact_render_viewmanagers react_render_components_text LOCAL_STATIC_LIBRARIES := @@ -42,6 +42,7 @@ $(call import-module,react/renderer/core) $(call import-module,react/renderer/components/root) $(call import-module,react/renderer/components/scrollview) $(call import-module,react/renderer/components/unimplementedview) +$(call import-module,react/renderer/components/text) $(call import-module,react/renderer/components/view) $(call import-module,react/renderer/debug) $(call import-module,react/renderer/graphics) @@ -53,4 +54,4 @@ $(call import-module,react/renderer/templateprocessor) $(call import-module,react/renderer/textlayoutmanager) $(call import-module,react/renderer/uimanager) -#$(call import-module,react/fabric/viewmanagers/jni) +# $(call import-module,react/fabric/viewmanagers/jni) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK index ee65f8ae7cf..730819a65c4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK @@ -45,5 +45,6 @@ rn_xplat_cxx_library( # TODO T71316899: Extract CoreComponentsRegistry out of this module # The following dependencies are required by CoreComponentsRegistry "//xplat/js/react-native-github:generated_components-rncore", + react_native_xplat_target("react/renderer/components/text:text"), ], ) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp index f8c23862a3c..4729173ad4d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp @@ -13,6 +13,9 @@ #include #include +#include +#include +#include #include namespace facebook { @@ -30,6 +33,12 @@ CoreComponentsRegistry::sharedProviderRegistry() { providerRegistry->add( concreteComponentDescriptorProvider()); + providerRegistry->add( + concreteComponentDescriptorProvider()); + providerRegistry->add( + concreteComponentDescriptorProvider()); + providerRegistry->add( + concreteComponentDescriptorProvider()); return providerRegistry; }(); @@ -44,7 +53,6 @@ CoreComponentsRegistry::initHybrid( auto instance = makeCxxInstance(delegate); // TODO T69453179: Codegen this file - auto buildRegistryFunction = [](EventDispatcher::Weak const &eventDispatcher, ContextContainer::Shared const &contextContainer) diff --git a/ReactCommon/react/renderer/components/text/Android.mk b/ReactCommon/react/renderer/components/text/Android.mk new file mode 100644 index 00000000000..3e8144673a6 --- /dev/null +++ b/ReactCommon/react/renderer/components/text/Android.mk @@ -0,0 +1,40 @@ +# 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. + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := react_render_components_text + +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/ +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../ + +LOCAL_CFLAGS := \ + -DLOG_TAG=\"Fabric\" + +LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall + +LOCAL_STATIC_LIBRARIES := + +LOCAL_SHARED_LIBRARIES := libyoga glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics libreact_render_uimanager libreact_render_textlayoutmanager libreact_render_attributedstring libreact_render_mounting libreact_render_components_view libreact_utils + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,glog) +$(call import-module,folly) +$(call import-module,fbgloginit) +$(call import-module,react/renderer/attributedstring) +$(call import-module,react/renderer/core) +$(call import-module,react/renderer/debug) +$(call import-module,react/renderer/graphics) +$(call import-module,react/renderer/mounting) +$(call import-module,react/renderer/textlayoutmanager) +$(call import-module,react/renderer/uimanager) +$(call import-module,react/renderer/components/view) +$(call import-module,react/utils) +$(call import-module,yogajni) diff --git a/ReactCommon/react/renderer/textlayoutmanager/Android.mk b/ReactCommon/react/renderer/textlayoutmanager/Android.mk index 8047965fa1c..d048ec00061 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/Android.mk +++ b/ReactCommon/react/renderer/textlayoutmanager/Android.mk @@ -15,9 +15,9 @@ LOCAL_SHARED_LIBRARIES := libfolly_futures libreactnativeutilsjni libreact_utils LOCAL_STATIC_LIBRARIES := -LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ $(LOCAL_PATH)/platform/cxx/android/ +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ $(LOCAL_PATH)/platform/android/ -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ $(LOCAL_PATH)/platform/cxx/android/ +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ $(LOCAL_PATH)/platform/android/ LOCAL_CFLAGS := \ -DLOG_TAG=\"Fabric\"