Skip to content

Text: Fix selectable prop mapping (was isSelectable) for Fabric - ensure correct macro conversion #51187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
_paragraphAttributes = newParagraphProps.paragraphAttributes;
_textView.paragraphAttributes = _paragraphAttributes;

if (newParagraphProps.isSelectable != oldParagraphProps.isSelectable) {
if (newParagraphProps.isSelectable) {
if (newParagraphProps.selectable != oldParagraphProps.selectable) {
if (newParagraphProps.selectable) {
[self enableContextMenu];
} else {
[self disableContextMenu];
Expand Down Expand Up @@ -329,14 +329,14 @@ - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture
- (BOOL)canBecomeFirstResponder
{
const auto &paragraphProps = static_cast<const ParagraphProps &>(*_props);
return paragraphProps.isSelectable;
return paragraphProps.selectable;
}

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
const auto &paragraphProps = static_cast<const ParagraphProps &>(*_props);

if (paragraphProps.isSelectable && action == @selector(copy:)) {
if (paragraphProps.selectable && action == @selector(copy:)) {
return YES;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ ParagraphProps::ParagraphProps(
rawProps,
sourceProps.paragraphAttributes,
{})),
isSelectable(
selectable(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.isSelectable
? sourceProps.selectable
: convertRawProp(
context,
rawProps,
"selectable",
sourceProps.isSelectable,
sourceProps.selectable,
false)),
onTextLayout(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
Expand Down Expand Up @@ -129,7 +129,7 @@ void ParagraphProps::setProp(
}

switch (hash) {
RAW_SET_PROP_SWITCH_CASE_BASIC(isSelectable);
RAW_SET_PROP_SWITCH_CASE_BASIC(selectable);
RAW_SET_PROP_SWITCH_CASE_BASIC(onTextLayout);
}

Expand All @@ -148,7 +148,7 @@ SharedDebugStringConvertibleList ParagraphProps::getDebugProps() const {
return ViewProps::getDebugProps() + BaseTextProps::getDebugProps() +
paragraphAttributes.getDebugProps() +
SharedDebugStringConvertibleList{
debugStringConvertibleItem("isSelectable", isSelectable)};
debugStringConvertibleItem("selectable", selectable)};
}
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ParagraphProps : public ViewProps, public BaseTextProps {
/*
* Defines can the text be selected (and copied) or not.
*/
bool isSelectable{};
bool selectable{};

bool onTextLayout{};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const char ParagraphComponentName[] = "Paragraph";

void ParagraphShadowNode::initialize() noexcept {
#ifdef ANDROID
if (getConcreteProps().isSelectable) {
if (getConcreteProps().selectable) {
traits_.set(ShadowNodeTraits::Trait::KeyboardFocusable);
}
#endif
Expand Down
Loading