Skip to content

Commit

Permalink
Remove unused code in AndroidTextInputShadowNode.h|cpp (#48136)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
christophpurrer authored and facebook-github-bot committed Dec 7, 2024
1 parent 6200a4d commit e9f92fa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,10 @@ class AndroidTextInputComponentDescriptor final
auto& textInputShadowNode =
static_cast<AndroidTextInputShadowNode&>(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<ContextContainer*>(getContextContainer().get()));

int surfaceId = textInputShadowNode.getSurfaceId();
if (surfaceIdToThemePaddingMap_.find(surfaceId) !=
surfaceIdToThemePaddingMap_.end()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

#include "AndroidTextInputShadowNode.h"

#include <fbjni/fbjni.h>
#include <react/debug/react_native_assert.h>
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/jni/ReadableNativeMap.h>
#include <react/renderer/attributedstring/AttributedStringBox.h>
#include <react/renderer/attributedstring/TextAttributes.h>
#include <react/renderer/components/text/BaseTextShadowNode.h>
Expand All @@ -19,20 +16,10 @@
#include <react/renderer/core/conversions.h>
#include <react/renderer/textlayoutmanager/TextLayoutContext.h>

#include <utility>

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
#include "AndroidTextInputProps.h"
#include "AndroidTextInputState.h"

#include <react/renderer/attributedstring/AttributedString.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <react/utils/ContextContainer.h>

#include <react/renderer/attributedstring/AttributedString.h>

namespace facebook::react {

extern const char AndroidTextInputComponentName[];
Expand All @@ -40,8 +39,6 @@ class AndroidTextInputShadowNode final

using ConcreteViewShadowNode::ConcreteViewShadowNode;

void setContextContainer(ContextContainer* contextContainer);

/*
* Returns a `AttributedString` which represents text content of the node.
*/
Expand All @@ -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);

Expand All @@ -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.
*/
Expand Down

0 comments on commit e9f92fa

Please sign in to comment.