From e9f92fad0a6ddfffedb50748e70d80ec3c879fb0 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Fri, 6 Dec 2024 20:38:43 -0800 Subject: [PATCH] Remove unused code in AndroidTextInputShadowNode.h|cpp (#48136) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48136 [Changelog] [Internal] - Remove unused code in AndroidTextInputShadowNode.h|cpp A bit of code clean-up to simplify a planned refactoring of this class Reviewed By: rshest Differential Revision: D66862820 fbshipit-source-id: 88114d8711b572f105d804cdddc6c087c94e3f49 --- .../AndroidTextInputComponentDescriptor.h | 5 +---- .../androidtextinput/AndroidTextInputShadowNode.cpp | 13 ------------- .../androidtextinput/AndroidTextInputShadowNode.h | 11 +++-------- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h index dd31d0ba53d..f5cb1dbabc8 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h @@ -80,13 +80,10 @@ class AndroidTextInputComponentDescriptor final auto& textInputShadowNode = static_cast(shadowNode); - // `ParagraphShadowNode` uses `TextLayoutManager` to measure text content + // `TextInputShadowNode` uses `TextLayoutManager` to measure text content // and communicate text rendering metrics to mounting layer. textInputShadowNode.setTextLayoutManager(textLayoutManager_); - textInputShadowNode.setContextContainer( - const_cast(getContextContainer().get())); - int surfaceId = textInputShadowNode.getSurfaceId(); if (surfaceIdToThemePaddingMap_.find(surfaceId) != surfaceIdToThemePaddingMap_.end()) { diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp index e45bca14842..7b856107a78 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp @@ -7,10 +7,7 @@ #include "AndroidTextInputShadowNode.h" -#include -#include #include -#include #include #include #include @@ -19,20 +16,10 @@ #include #include -#include - -using namespace facebook::jni; - namespace facebook::react { extern const char AndroidTextInputComponentName[] = "AndroidTextInput"; -void AndroidTextInputShadowNode::setContextContainer( - ContextContainer* contextContainer) { - ensureUnsealed(); - contextContainer_ = contextContainer; -} - AttributedString AndroidTextInputShadowNode::getAttributedString() const { // Use BaseTextShadowNode to get attributed string from children auto childTextAttributes = TextAttributes::defaultTextAttributes(); diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h index c4d3aefae63..94277f468c6 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h @@ -11,11 +11,10 @@ #include "AndroidTextInputProps.h" #include "AndroidTextInputState.h" +#include #include #include -#include - namespace facebook::react { extern const char AndroidTextInputComponentName[]; @@ -40,8 +39,6 @@ class AndroidTextInputShadowNode final using ConcreteViewShadowNode::ConcreteViewShadowNode; - void setContextContainer(ContextContainer* contextContainer); - /* * Returns a `AttributedString` which represents text content of the node. */ @@ -50,8 +47,8 @@ class AndroidTextInputShadowNode final /* * Associates a shared TextLayoutManager with the node. - * `ParagraphShadowNode` uses the manager to measure text content - * and construct `ParagraphState` objects. + * `TextInputShadowNode` uses the manager to measure text content + * and construct `TextInputState` objects. */ void setTextLayoutManager(SharedTextLayoutManager textLayoutManager); @@ -65,8 +62,6 @@ class AndroidTextInputShadowNode final Float baseline(const LayoutContext& layoutContext, Size size) const override; private: - ContextContainer* contextContainer_{}; - /** * Get the most up-to-date attributed string for measurement and State. */