mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook GitHub Bot
parent
eee1d8b11d
commit
b743af0aef
-17
@@ -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.
|
||||
*/
|
||||
|
||||
-13
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
-4
@@ -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
|
||||
|
||||
-4
@@ -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,
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user