diff --git a/react-native-harmony/Libraries/Components/Button/Button.harmony.js b/react-native-harmony/Libraries/Components/Button/Button.harmony.js index 2e990a9cd126e14e8b4cf52e5c397325b931ad42..98f92d337555e58622b21007dd56cfc930be94a8 100644 --- a/react-native-harmony/Libraries/Components/Button/Button.harmony.js +++ b/react-native-harmony/Libraries/Components/Button/Button.harmony.js @@ -379,8 +379,8 @@ class Button extends React.Component { testID={testID} disabled={disabled} onPress={onPress} - touchSoundDisabled={touchSoundDisabled}> - + touchSoundDisabled={touchSoundDisabled}> + {formattedTitle} diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/CppComponentInstance.h b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/CppComponentInstance.h index c83633d9c5ce2b5b499a1e26ec08ae2a5d1acc7e..8a920e457eb44ef74dbd010a10a2ba19e70f8063 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/CppComponentInstance.h +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/CppComponentInstance.h @@ -502,6 +502,14 @@ class CppComponentInstance : public ComponentInstance, this->getLocalRootArkUINode().setRenderGroup(m_rawProps.needsOffscreenAlphaCompositing); } + if (props->rawProps.count("focusable") > 0) { + if (!m_props || + props->rawProps["focusable"].asBool() != + m_props->rawProps["focusable"].asBool()) { + getLocalRootArkUINode().setFocusable(props->rawProps["focusable"].asBool()); + } + } + this->getLocalRootArkUINode().setId(getIdFromProps(props)); m_oldBorderMetrics = props->resolveBorderMetrics(this->m_layoutMetrics); diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ArkUINode.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ArkUINode.cpp index 54096b054f90ea88980b6c1961da78eb12dffb76..c0b01612449d7e0ab6d2fed655a2f30297086e02 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ArkUINode.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ArkUINode.cpp @@ -771,6 +771,16 @@ ArkUINode& ArkUINode::setZIndex(float index) { return *this; } +ArkUINode& ArkUINode::setFocusable(bool focusable) { + int32_t focusableValue = focusable; + ArkUI_NumberValue preparedFocusable[] = {{.i32 = focusableValue}}; + ArkUI_AttributeItem focusItem = { + preparedFocusable, sizeof(preparedFocusable) / sizeof(ArkUI_NumberValue)}; + maybeThrow(NativeNodeApi::getInstance()->setAttribute( + m_nodeHandle, NODE_FOCUSABLE, &focusItem)); + return *this; +} + ArkUINode& ArkUINode::setRenderGroup(bool flag) { ArkUI_NumberValue value[] = {{.i32 = (int32_t)flag}}; ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ArkUINode.h b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ArkUINode.h index 9744ddbd12e2bbbdf02369cdc8f5edf1058e01aa..bf4a9b3716431a2a738e42c868e85ffd0af52ef3 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ArkUINode.h +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ArkUINode.h @@ -144,6 +144,7 @@ class ArkUINode { virtual ArkUINode& setRenderGroup(bool flag); virtual ArkUINode& setDirection(ArkUI_Direction direction); virtual ArkUINode& setZIndex(float index); + virtual ArkUINode& setFocusable(bool focusable); virtual ArkUINode& resetAccessibilityText();