From 7d09c638f50b3c0596ddda58b0633fcc5f76ce98 Mon Sep 17 00:00:00 2001 From: caocan <1532643766@qq.com> Date: Wed, 13 Apr 2022 12:20:17 +0800 Subject: [PATCH] fix swiper in launcher don't show child Signed-off-by: caocan <1532643766@qq.com> Change-Id: I86a307d16b9a48776c8fb8665fc1687a9622cf90 --- frameworks/core/components/swiper/render_swiper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frameworks/core/components/swiper/render_swiper.cpp b/frameworks/core/components/swiper/render_swiper.cpp index 5924aa87..60ad1b1f 100644 --- a/frameworks/core/components/swiper/render_swiper.cpp +++ b/frameworks/core/components/swiper/render_swiper.cpp @@ -189,7 +189,9 @@ void RenderSwiper::Update(const RefPtr& component) remoteMessageEvent_ = AceAsyncEvent&)>::Create( swiper->GetRemoteMessageEventId(), context_); RegisterChangeEndListener(COMPONENT_CHANGE_END_LISTENER_KEY, swiper->GetChangeEndListener()); - if (swiper && swiper_ && (*swiper == *swiper_) && currentIndex_ == static_cast(swiper->GetIndex())) { + auto lazyComponent = swiper->GetLazyForEachComponent(); + if (swiper && swiper_ && (*swiper == *swiper_) && + currentIndex_ == static_cast(swiper->GetIndex()) && lazyComponent) { LOGI("swiper not changed"); swiper_ = swiper; return; @@ -254,7 +256,6 @@ void RenderSwiper::Update(const RefPtr& component) showIndicator_ = swiper->IsShowIndicator(); lazyLoadCacheSize_ = swiper->GetCachedSize() * 2 + swiper->GetDisplayCount(); - auto lazyComponent = swiper->GetLazyForEachComponent(); UpdateItemCount(lazyComponent ? static_cast(lazyComponent->TotalCount()) : itemCount_); ClearItems(lazyComponent, static_cast(swiper->GetIndex()));