Back out "Add KeyboardFocusableNode ShadowNodeTrait"

Summary:
Original commit changeset: dcc2410b408e

Original Phabricator Diff: D72258544

Changelog: [Internal]

Differential Revision: D73103169

fbshipit-source-id: ff51309f8470664a6f0859ff729bd4b155ffb0a4
This commit is contained in:
Gijs Weterings
2025-04-16 07:28:41 -07:00
committed by Facebook GitHub Bot
parent eee1d8b11d
commit b743af0aef
6 changed files with 0 additions and 47 deletions
@@ -26,22 +26,6 @@ using Content = ParagraphShadowNode::Content;
const char ParagraphComponentName[] = "Paragraph";
void ParagraphShadowNode::initialize() noexcept {
#ifdef ANDROID
if (getConcreteProps().isSelectable) {
traits_.set(ShadowNodeTraits::Trait::KeyboardFocusable);
}
#endif
}
ParagraphShadowNode::ParagraphShadowNode(
const ShadowNodeFragment& fragment,
const ShadowNodeFamily::Shared& family,
ShadowNodeTraits traits)
: ConcreteViewShadowNode(fragment, family, traits) {
initialize();
}
ParagraphShadowNode::ParagraphShadowNode(
const ShadowNode& sourceShadowNode,
const ShadowNodeFragment& fragment)
@@ -65,7 +49,6 @@ ParagraphShadowNode::ParagraphShadowNode(
// to stop Yoga from traversing it.
cleanLayout();
}
initialize();
}
const Content& ParagraphShadowNode::getContent(
@@ -35,11 +35,6 @@ class ParagraphShadowNode final : public ConcreteViewShadowNode<
public:
using ConcreteViewShadowNode::ConcreteViewShadowNode;
ParagraphShadowNode(
const ShadowNodeFragment& fragment,
const ShadowNodeFamily::Shared& family,
ShadowNodeTraits traits);
ParagraphShadowNode(
const ShadowNode& sourceShadowNode,
const ShadowNodeFragment& fragment);
@@ -89,7 +84,6 @@ class ParagraphShadowNode final : public ConcreteViewShadowNode<
};
private:
void initialize() noexcept;
/*
* Builds (if needed) and returns a reference to a `Content` object.
*/
@@ -7,7 +7,6 @@
#pragma once
#include <react/renderer/components/view/HostPlatformViewTraitsInitializer.h>
#include <react/renderer/components/view/ViewEventEmitter.h>
#include <react/renderer/components/view/ViewProps.h>
#include <react/renderer/components/view/YogaLayoutableShadowNode.h>
@@ -16,7 +15,6 @@
#include <react/renderer/core/ShadowNode.h>
#include <react/renderer/core/ShadowNodeFragment.h>
#include <react/renderer/debug/DebugStringConvertibleItem.h>
#include <type_traits>
namespace facebook::react {
@@ -31,7 +29,6 @@ template <
typename ViewEventEmitterT = ViewEventEmitter,
typename StateDataT = StateData,
bool usesMapBufferForStateData = false>
requires(std::is_base_of_v<ViewProps, ViewPropsT>)
class ConcreteViewShadowNode : public ConcreteShadowNode<
concreteComponentName,
YogaLayoutableShadowNode,
@@ -120,16 +117,6 @@ class ConcreteViewShadowNode : public ConcreteShadowNode<
} else {
BaseShadowNode::orderIndex_ = 0;
}
bool isKeyboardFocusable =
HostPlatformViewTraitsInitializer::isKeyboardFocusable(props) ||
props.accessible;
if (isKeyboardFocusable) {
BaseShadowNode::traits_.set(ShadowNodeTraits::Trait::KeyboardFocusable);
} else {
BaseShadowNode::traits_.unset(ShadowNodeTraits::Trait::KeyboardFocusable);
}
}
};
@@ -24,8 +24,4 @@ inline bool formsView(const ViewProps& viewProps) {
viewProps.renderToHardwareTextureAndroid;
}
inline bool isKeyboardFocusable(const ViewProps& viewProps) {
return (viewProps.focusable || viewProps.hasTVPreferredFocus);
}
} // namespace facebook::react::HostPlatformViewTraitsInitializer
@@ -20,8 +20,4 @@ inline bool formsView(const ViewProps& props) {
return false;
}
inline bool isKeyboardFocusable(const ViewProps& /*props*/) {
return false;
}
} // namespace facebook::react::HostPlatformViewTraitsInitializer
@@ -78,9 +78,6 @@ class ShadowNodeTraits {
// Forces the node not to form a host view.
ForceFlattenView = 1 << 11,
// Indicates if the node is keyboard focusable.
KeyboardFocusable = 1 << 12,
};
/*