From 8c035cd32ebbdb98997f692ef4dc34ac671a9bcf Mon Sep 17 00:00:00 2001 From: Arkadiusz Kasprzyk Date: Thu, 14 Nov 2024 11:04:55 +0100 Subject: [PATCH 1/5] fix: map the accessible prop correctly The `accessible` prop was mapped improperly. - fixed behavior of the accessible prop - deprecated ArkUINode::setAccessibilityLevel Run test cases added in this PR. - [x] Project compiles and the tester application works. Closes https://gl.swmansion.com/rnoh/react-native-harmony/-/issues/1381 See merge request rnoh/react-native-harmony!1700 Signed-off-by: chenhaoyue --- .../src/main/cpp/RNOH/CppComponentInstance.h | 14 ++---- .../src/main/cpp/RNOH/arkui/ArkUINode.cpp | 36 ++++++++++++- .../src/main/cpp/RNOH/arkui/ArkUINode.h | 4 +- .../tests/ViewTest/ViewAccessibilityTest.tsx | 50 +++++++++++++++++++ tester/tests/ViewTest/ViewTest.tsx | 16 ------ 5 files changed, 91 insertions(+), 29 deletions(-) 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 d32fbc68..6e26558a 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 @@ -438,11 +438,11 @@ class CppComponentInstance : public ComponentInstance, if (!old) { if (static_cast(props->importantForAccessibility) != 0) { - this->getLocalRootArkUINode().setAccessibilityLevel( + this->getLocalRootArkUINode().setAccessibilityMode( props->importantForAccessibility); } } else if (props->importantForAccessibility != old->importantForAccessibility) { - this->getLocalRootArkUINode().setAccessibilityLevel( + this->getLocalRootArkUINode().setAccessibilityMode( props->importantForAccessibility); } else { // Do nothing here. @@ -462,16 +462,10 @@ class CppComponentInstance : public ComponentInstance, if (!old) { if (static_cast(props->accessible) != 0) { - ArkUI_AccessibilityMode mode = props->accessible - ? ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_ENABLED - : ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_DISABLED; - this->getLocalRootArkUINode().setAccessibilityMode(mode); + this->getLocalRootArkUINode().setAccessibilityGroup(props->accessible); } } else if (props->accessible != old->accessible) { - ArkUI_AccessibilityMode mode = props->accessible - ? ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_ENABLED - : ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_DISABLED; - this->getLocalRootArkUINode().setAccessibilityMode(mode); + this->getLocalRootArkUINode().setAccessibilityGroup(props->accessible); } else { // Do nothing here. } 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 019ebe12..0622a7f7 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 @@ -489,6 +489,38 @@ ArkUINode& ArkUINode::setAccessibilityLevel( return *this; } +ArkUINode& ArkUINode::setAccessibilityMode( + facebook::react::ImportantForAccessibility importance) { + switch (importance) { + case facebook::react::ImportantForAccessibility::Auto: + this->setAccessibilityMode( + ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_AUTO); + break; + case facebook::react::ImportantForAccessibility::Yes: + this->setAccessibilityMode( + ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_ENABLED); + break; + case facebook::react::ImportantForAccessibility::No: + this->setAccessibilityMode( + ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_DISABLED); + break; + case facebook::react::ImportantForAccessibility::NoHideDescendants: + this->setAccessibilityMode( + ArkUI_AccessibilityMode:: + ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS); + break; + default: + DLOG(WARNING) << "Unsupported importantForAccessibility value"; + } + return *this; +} + +ArkUINode& ArkUINode::setAccessibilityMode(ArkUI_AccessibilityMode mode) { + ArkUI_NumberValue value = {.i32 = mode}; + setAttribute(NODE_ACCESSIBILITY_MODE, {value}); + return *this; +} + ArkUINode& ArkUINode::setAccessibilityText( std::string const& accessibilityLabel) { ArkUI_AttributeItem textItem = {.string = accessibilityLabel.c_str()}; @@ -497,8 +529,8 @@ ArkUINode& ArkUINode::setAccessibilityText( return *this; } -ArkUINode& ArkUINode::setAccessibilityGroup(bool accessible) { - ArkUI_NumberValue groupValue[] = {{.i32 = static_cast(accessible)}}; +ArkUINode& ArkUINode::setAccessibilityGroup(bool enableGroup) { + ArkUI_NumberValue groupValue[] = {{.i32 = static_cast(enableGroup)}}; ArkUI_AttributeItem groupItem = { .value = groupValue, .size = sizeof(groupValue) / 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 3264c7ce..9744ddbd 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 @@ -115,10 +115,12 @@ class ArkUINode { const facebook::react::AccessibilityState& state); virtual ArkUINode& setAccessibilityLevel( facebook::react::ImportantForAccessibility importance); + virtual ArkUINode& setAccessibilityMode( + facebook::react::ImportantForAccessibility importance); + virtual ArkUINode& setAccessibilityMode(ArkUI_AccessibilityMode mode); virtual ArkUINode& setAccessibilityText( std::string const& accessibilityLabel); virtual ArkUINode& setAccessibilityGroup(bool accessible); - virtual ArkUINode& setAccessibilityMode(ArkUI_AccessibilityMode mode); virtual ArkUINode& setId(std::string const& id); virtual std::string getId() const; virtual ArkUINode& setOpacity(facebook::react::Float opacity); diff --git a/tester/tests/ViewTest/ViewAccessibilityTest.tsx b/tester/tests/ViewTest/ViewAccessibilityTest.tsx index 54eb4f82..d32b32cd 100644 --- a/tester/tests/ViewTest/ViewAccessibilityTest.tsx +++ b/tester/tests/ViewTest/ViewAccessibilityTest.tsx @@ -137,6 +137,24 @@ const ANNOUNCEMENT_BY_PLATFORM_BY_ROLE = new Map< export function ViewAccessibilityTest() { return ( + + + + + The cyan container is accessible... + + + + + ...and the pink container is not. + + + + + + + + + aria-hidden: false + + + aria-hidden: true + + + + + View: aria-hidden=true + + This item shouldn't be focusable + + View: aria-hidden=false + + + This item should be focusable and announced + + + + - - - - First layout - - - Hidden Layout - - - Date: Sun, 1 Dec 2024 23:37:38 +0100 Subject: [PATCH 2/5] Text visible for screen reader This PR makes text visible for screen reader by default. - Set `ARKUI_ACCESSIBILITY_MODE_ENABLED` if text isn't in component with `AccessibilityGroup` set to true 1. Open tester app. 2. Run "Text::make the screen reader say "This is accessible text". - [ ] Project compiles and the tester application works. Closes: #1404 See merge request rnoh/react-native-harmony!1716 Signed-off-by: chenhaoyue --- .../src/main/cpp/RNOH/ComponentInstance.h | 3 +++ .../src/main/cpp/RNOH/CppComponentInstance.h | 7 +++++++ .../ComponentInstances/TextComponentInstance.cpp | 10 ++++++++++ .../ComponentInstances/TextComponentInstance.h | 3 ++- tester/tests/TextTest/TextAccessibilityTest.tsx | 1 - 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/ComponentInstance.h b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/ComponentInstance.h index 8f7e9119..044ae6dc 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/ComponentInstance.h +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/ComponentInstance.h @@ -115,6 +115,9 @@ class ComponentInstance void removeChild(ComponentInstance::Shared childComponentInstance); virtual facebook::react::Props::Shared getProps() const = 0; + + + virtual bool getAccessibilityGroup() const = 0; /** * TODO: change to protected — those methods are intended to be called 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 6e26558a..c83633d9 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 @@ -108,6 +108,10 @@ class CppComponentInstance : public ComponentInstance, const std::string& getAccessibilityLabel() const override { return m_accessibilityLabel; } + + bool getAccessibilityGroup() const override { + return m_accessibilityGroup; + } /** * TODO: change to private — those methods are intended to be called @@ -463,9 +467,11 @@ class CppComponentInstance : public ComponentInstance, if (!old) { if (static_cast(props->accessible) != 0) { this->getLocalRootArkUINode().setAccessibilityGroup(props->accessible); + m_accessibilityGroup = props->accessible; } } else if (props->accessible != old->accessible) { this->getLocalRootArkUINode().setAccessibilityGroup(props->accessible); + m_accessibilityGroup = props->accessible; } else { // Do nothing here. } @@ -688,6 +694,7 @@ class CppComponentInstance : public ComponentInstance, private: std::vector m_accessibilityLabelledBy{}; std::string m_accessibilityLabel; + bool m_accessibilityGroup; }; inline facebook::react::Rect transformRectAroundPoint( diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp index 54acb045..832ebddb 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp @@ -186,6 +186,16 @@ void TextComponentInstance::onPropsChanged( VLOG(3) << "[text-debug] setProps end"; } +void TextComponentInstance::onFinalizeUpdates() { + auto parent = m_parent.lock(); + if (m_props->importantForAccessibility == + facebook::react::ImportantForAccessibility::Auto && + parent && !parent->getAccessibilityGroup()) { + m_textNode.setAccessibilityMode( + ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_ENABLED); + } +} + void TextComponentInstance::onStateChanged( SharedConcreteState const& textState) { CppComponentInstance::onStateChanged(textState); diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.h b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.h index a4c38e08..38b5b680 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.h +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.h @@ -46,7 +46,8 @@ class TextComponentInstance void onPropsChanged(SharedConcreteProps const& props) override; void onStateChanged(SharedConcreteState const& textState) override; const std::string& getAccessibilityLabel() const override; - + void onFinalizeUpdates() override; + private: void setTextAttributes(const facebook::react::TextAttributes& textAttributes); void updateFragmentTouchTargets( diff --git a/tester/tests/TextTest/TextAccessibilityTest.tsx b/tester/tests/TextTest/TextAccessibilityTest.tsx index b27d1562..f2747702 100644 --- a/tester/tests/TextTest/TextAccessibilityTest.tsx +++ b/tester/tests/TextTest/TextAccessibilityTest.tsx @@ -14,7 +14,6 @@ export function TextAccessibilityTest() { This is accessible text -- Gitee From 63271c43fc40d116c0bd28d48ccdcf2bda32c7a9 Mon Sep 17 00:00:00 2001 From: chenhaoyue Date: Mon, 17 Feb 2025 17:58:04 +0800 Subject: [PATCH 3/5] The time when finalizeMutationUpdates is triggered due to mutation submission is fixed. Signed-off-by: chenhaoyue --- .../src/main/cpp/RNOH/MountingManager.h | 2 ++ .../src/main/cpp/RNOH/MountingManagerArkTS.cpp | 2 ++ .../src/main/cpp/RNOH/MountingManagerArkTS.h | 2 ++ .../src/main/cpp/RNOH/SchedulerDelegate.cpp | 5 +++++ .../src/main/cpp/RNOH/arkui/ArkUINode.cpp | 7 ------- .../ComponentInstances/TextComponentInstance.cpp | 5 ----- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManager.h b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManager.h index 6ae3cb6d..18c5c9d7 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManager.h +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManager.h @@ -36,6 +36,8 @@ class MountingManager { virtual void didMount(MutationList const& mutations) = 0; + virtual void finalizeMutationUpdates(MutationList const& mutations) = 0; + virtual void dispatchCommand( const facebook::react::ShadowView& shadowView, const std::string& commandName, diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManagerArkTS.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManagerArkTS.cpp index e6b99d2f..1e3e88a7 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManagerArkTS.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManagerArkTS.cpp @@ -55,6 +55,8 @@ void MountingManagerArkTS::didMount(MutationList const& mutations) { this->triggerUICallback(mutations); } +void MountingManagerArkTS::finalizeMutationUpdates(MutationList const& mutations) {} + void MountingManagerArkTS::dispatchCommand( const facebook::react::ShadowView& shadowView, const std::string& commandName, diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManagerArkTS.h b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManagerArkTS.h index d3a9db45..2f4ed0f0 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManagerArkTS.h +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/MountingManagerArkTS.h @@ -56,6 +56,8 @@ class MountingManagerArkTS final : public MountingManager { void didMount(MutationList const& mutations) override; + void finalizeMutationUpdates(MutationList const& mutations) override; + void dispatchCommand( const facebook::react::ShadowView& shadowView, const std::string& commandName, diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/SchedulerDelegate.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/SchedulerDelegate.cpp index 9be6c44b..a50f8577 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/SchedulerDelegate.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/SchedulerDelegate.cpp @@ -65,7 +65,12 @@ void SchedulerDelegate::schedulerDidFinishTransaction( [otherMutation, this](MountingManager::Shared const& mountingManager) { mountingManager->didMount(otherMutation); + }); + performOnMainThread( + [mutationVecs, this](MountingManager::Shared + const& mountingManager) { mountingManager->clearPreallocatedViews(); + mountingManager->finalizeMutationUpdates(mutationVecs); }); logTransactionTelemetryMarkers(transaction); }); 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 0622a7f7..54096b05 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 @@ -830,11 +830,4 @@ void ArkUINode::setAttribute( setAttribute(attribute, item); } -ArkUINode& ArkUINode::setAccessibilityMode(ArkUI_AccessibilityMode mode) -{ - ArkUI_NumberValue value = {.i32 = mode}; - setAttribute(NODE_ACCESSIBILITY_MODE, {value}); - return *this; -} - } // namespace rnoh diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp index 832ebddb..ca4ec86e 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp @@ -86,11 +86,6 @@ void TextComponentInstance::onPropsChanged( } m_textNode.setTextCopyOption(testCopyOption); - // Because the default text text in harmony is not focused without barrier, the default value is yes. - if (static_cast(textProps->importantForAccessibility) == 0) { - facebook::react::ImportantForAccessibility accessibilityValue = facebook::react::ImportantForAccessibility::Yes; - this->getLocalRootArkUINode().setAccessibilityLevel(accessibilityValue); - } if (textProps->rawProps != nullptr) { // stack align -- Gitee From 126f3933ebf425efb56217213067b3415a5ce9d9 Mon Sep 17 00:00:00 2001 From: Arkadiusz Kasprzyk Date: Wed, 19 Feb 2025 11:52:46 +0100 Subject: [PATCH 4/5] fix: default Image accessibility behavior On Android images can be focused by default in accessibility mode, on OHOS they are not. This MR fixes this problem. Also, in bridgeless mode `importantForAccessibility` doesn't work, because RN chooses view configs defined on JS side. Run the following demo. I didn't add a test case because currently tester doesn't render all test cases properly. (https://gl.swmansion.com/rnoh/react-native-harmony/-/issues/1502) ```tsx import React from 'react'; import {View, Image} from 'react-native'; const Demo = () => { return ( ); }; export default Demo; ``` Closes https://gl.swmansion.com/rnoh/react-native-harmony/-/issues/1500 See merge request rnoh/react-native-harmony!1832 Signed-off-by: chenhaoyue --- .../src/main/cpp/RNOH/arkui/ImageNode.cpp | 9 +++++++++ .../src/main/cpp/RNOH/arkui/ImageNode.h | 2 ++ .../ComponentInstances/ImageComponentInstance.cpp | 3 +++ 3 files changed, 14 insertions(+) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ImageNode.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ImageNode.cpp index 6e22443b..6af7aef6 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ImageNode.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ImageNode.cpp @@ -213,6 +213,15 @@ ImageNode& ImageNode::setFadeDuration(int32_t duration) { return *this; } +ImageNode& ImageNode::setAccessibilityMode( + facebook::react::ImportantForAccessibility importance) { +if (importance == facebook::react::ImportantForAccessibility::Auto) { + ArkUINode::setAccessibilityMode( + ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_ENABLED); +} else { + ArkUINode::setAccessibilityMode(importance); +} + ImageNode& ImageNode::resetFocusable() { maybeThrow(NativeNodeApi::getInstance()->resetAttribute( m_nodeHandle, NODE_FOCUSABLE)); diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ImageNode.h b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ImageNode.h index 4244530c..52ab6f89 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ImageNode.h +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/ImageNode.h @@ -45,6 +45,8 @@ class ImageNode : public ArkUINode { ImageNode& setResizeMethod(std::string const& resizeMethod); ImageNode& setAlt(std::string const& uri, std::string prefix = ""); ImageNode& setFadeDuration(int32_t duration); + ImageNode& setAccessibilityMode( + facebook::react::ImportantForAccessibility importance) override; ImageNode& resetFocusable(); ImageNode& resetResizeMethod(); diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/ImageComponentInstance.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/ImageComponentInstance.cpp index ac31f42e..b70d8b07 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/ImageComponentInstance.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/ImageComponentInstance.cpp @@ -22,6 +22,9 @@ ImageComponentInstance::ImageComponentInstance(Context context) this->getLocalRootArkUINode().setInterpolation( ARKUI_IMAGE_INTERPOLATION_HIGH); this->getLocalRootArkUINode().setDraggable(false); + this->getLocalRootArkUINode().setAccessibilityMode( + facebook::react::ImportantForAccessibility::Auto); + } std::string ImageComponentInstance::FindLocalCacheByUri(std::string const& uri) { -- Gitee From 9d17bf24ca6af449e0639250619d1b1ead3bf184 Mon Sep 17 00:00:00 2001 From: chenhaoyue Date: Thu, 20 Feb 2025 10:11:03 +0800 Subject: [PATCH 5/5] Code standardization adjustment Signed-off-by: chenhaoyue --- .../ComponentInstances/TextComponentInstance.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp index ca4ec86e..e44b701b 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp @@ -182,13 +182,12 @@ void TextComponentInstance::onPropsChanged( } void TextComponentInstance::onFinalizeUpdates() { - auto parent = m_parent.lock(); - if (m_props->importantForAccessibility == - facebook::react::ImportantForAccessibility::Auto && - parent && !parent->getAccessibilityGroup()) { - m_textNode.setAccessibilityMode( - ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_ENABLED); - } + auto parent = m_parent.lock(); + if (m_props->importantForAccessibility == + facebook::react::ImportantForAccessibility::Auto && + parent && !parent->getAccessibilityGroup()) { + m_textNode.setAccessibilityMode(ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_ENABLED); + } } void TextComponentInstance::onStateChanged( -- Gitee