mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2025-03-07 11:44:41 +00:00
commit
26b25c652e
@ -393,6 +393,8 @@ void NavigationPattern::CheckTopNavPathChange(
|
||||
TransitionWithOutAnimation(preTopNavDestination, newTopNavDestination, isPopPage);
|
||||
navigationStack_->UpdateAnimatedValue(true);
|
||||
} else {
|
||||
// before the animation of navDes replacing, update the zIndex of the previous navDes node
|
||||
UpdatePreNavDesZIndex(preTopNavDestination, newTopNavDestination);
|
||||
// transition with animation need to run after layout task
|
||||
context->AddAfterLayoutTask(
|
||||
[preTopNavDestination, newTopNavDestination, isPopPage, weakNavigationPattern = WeakClaim(this)]() {
|
||||
@ -1283,4 +1285,26 @@ void NavigationPattern::OnColorConfigurationUpdate()
|
||||
CHECK_NULL_VOID(theme);
|
||||
dividerNode->GetRenderContext()->UpdateBackgroundColor(theme->GetNavigationDividerColor());
|
||||
}
|
||||
|
||||
void NavigationPattern::UpdatePreNavDesZIndex(const RefPtr<FrameNode> &preTopNavDestination,
|
||||
const RefPtr<FrameNode> &newTopNavDestination)
|
||||
{
|
||||
auto replaceVal = navigationStack_->GetReplaceValue();
|
||||
if (replaceVal != 0 && preTopNavDestination && newTopNavDestination) {
|
||||
auto hostNode = AceType::DynamicCast<NavigationGroupNode>(GetHost());
|
||||
CHECK_NULL_VOID(hostNode);
|
||||
auto navigationContentNode = AceType::DynamicCast<FrameNode>(hostNode->GetContentNode());
|
||||
CHECK_NULL_VOID(navigationContentNode);
|
||||
auto newDesNodeContext = newTopNavDestination->GetRenderContext();
|
||||
CHECK_NULL_VOID(newDesNodeContext);
|
||||
std::optional<int32_t> newNodeZIndex = newDesNodeContext->GetZIndex();
|
||||
auto preDesNodeContext = preTopNavDestination->GetRenderContext();
|
||||
CHECK_NULL_VOID(preDesNodeContext);
|
||||
preDesNodeContext->UpdateZIndex(newNodeZIndex.value_or(0) - 1);
|
||||
navigationContentNode->RebuildRenderContextTree();
|
||||
auto context = PipelineContext::GetCurrentContext();
|
||||
CHECK_NULL_VOID(context);
|
||||
context->RequestFrame();
|
||||
}
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -347,6 +347,8 @@ private:
|
||||
bool UpdateTitleModeChangeEventHub(const RefPtr<NavigationGroupNode>& hostNode);
|
||||
void NotifyPageShow(const std::string& pageName);
|
||||
int32_t FireNavDestinationStateChange(bool show);
|
||||
void UpdatePreNavDesZIndex(const RefPtr<FrameNode> &preTopNavDestination,
|
||||
const RefPtr<FrameNode> &newTopNavDestination);
|
||||
NavigationMode navigationMode_ = NavigationMode::AUTO;
|
||||
std::function<void(std::string)> builder_;
|
||||
RefPtr<NavigationStack> navigationStack_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user