mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
fix bug in get navdestination customNode
Signed-off-by: mayaolll <mayao17@huawei.com>
This commit is contained in:
parent
acdd9e9066
commit
7c6cebd0f7
@ -412,11 +412,12 @@ JSRef<JSVal> JSNavigationStack::GetOnPopByIndex(int32_t index) const
|
||||
}
|
||||
|
||||
bool JSNavigationStack::GetNavDestinationNodeInUINode(
|
||||
RefPtr<NG::UINode> node, RefPtr<NG::NavDestinationGroupNode>& desNode)
|
||||
RefPtr<NG::UINode>& node, RefPtr<NG::NavDestinationGroupNode>& desNode)
|
||||
{
|
||||
RefPtr<NG::CustomNode> customNode;
|
||||
while (node) {
|
||||
if (node->GetTag() == V2::JS_VIEW_ETS_TAG) {
|
||||
auto customNode = AceType::DynamicCast<NG::CustomNode>(node);
|
||||
customNode = AceType::DynamicCast<NG::CustomNode>(node);
|
||||
TAG_LOGI(AceLogTag::ACE_NAVIGATION, "render current custom node: %{public}s",
|
||||
customNode->GetCustomTag().c_str());
|
||||
// record parent navigationNode before customNode is rendered in case of navDestinationNode
|
||||
@ -426,6 +427,9 @@ bool JSNavigationStack::GetNavDestinationNodeInUINode(
|
||||
customNode->Render();
|
||||
} else if (node->GetTag() == V2::NAVDESTINATION_VIEW_ETS_TAG) {
|
||||
desNode = AceType::DynamicCast<NG::NavDestinationGroupNode>(node);
|
||||
if (customNode) {
|
||||
node = customNode;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
auto children = node->GetChildren();
|
||||
|
@ -125,7 +125,7 @@ private:
|
||||
JSRef<JSObject> GetJsPathInfo(int32_t index);
|
||||
std::string GetNameByIndex(int32_t index);
|
||||
JSRef<JSVal> GetOnPopByIndex(int32_t index) const;
|
||||
bool GetNavDestinationNodeInUINode(RefPtr<NG::UINode> node, RefPtr<NG::NavDestinationGroupNode>& desNode);
|
||||
bool GetNavDestinationNodeInUINode(RefPtr<NG::UINode>& node, RefPtr<NG::NavDestinationGroupNode>& desNode);
|
||||
int32_t GetSize() const;
|
||||
void SetJSParentStack(JSRef<JSVal> parent);
|
||||
static std::string ConvertParamToString(const JSRef<JSVal>& param);
|
||||
|
@ -111,26 +111,14 @@ void NavDestinationGroupNode::ProcessShallowBuilder()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Find and return the nearest custom node, which is of type 'JsView'
|
||||
*/
|
||||
RefPtr<CustomNodeBase> NavDestinationGroupNode::GetNavDestinationCustomNode()
|
||||
{
|
||||
auto pattern = GetPattern<NavDestinationPattern>();
|
||||
CHECK_NULL_RETURN(pattern, nullptr);
|
||||
auto navDestinationNode = pattern->GetCustomNode();
|
||||
CHECK_NULL_RETURN(navDestinationNode, nullptr);
|
||||
|
||||
auto child = navDestinationNode->GetFirstChild();
|
||||
while (child) {
|
||||
if (AceType::InstanceOf<NavDestinationGroupNode>(child)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (AceType::InstanceOf<CustomNodeBase>(child)) {
|
||||
auto customNode = DynamicCast<CustomNodeBase>(child);
|
||||
return customNode;
|
||||
}
|
||||
child = child->GetFirstChild();
|
||||
}
|
||||
return nullptr;
|
||||
return DynamicCast<CustomNodeBase>(pattern->GetCustomNode());
|
||||
}
|
||||
|
||||
void NavDestinationGroupNode::SetNavDestinationMode(NavDestinationMode mode)
|
||||
|
Loading…
Reference in New Issue
Block a user