Skip to content

Commit 173451b

Browse files
authored
fix:修复当内容宽度小于spring-scrollview设置的style宽度时滑动异常问题 (#33)
Signed-off-by: wupingyuan <wupingyuan2@h-partners.com>
1 parent e46e11b commit 173451b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

harmony/spring_scrollview/src/main/cpp/SpringScrollViewComponentInstance.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,11 @@ void SpringScrollViewComponentInstance::onStateChanged(SharedConcreteState const
224224
float tempHeight = (stateData.getContentSize().height < m_layoutMetrics.frame.size.height)
225225
? m_layoutMetrics.frame.size.height
226226
: stateData.getContentSize().height;
227+
float tempWidth = (stateData.getContentSize().width < m_layoutMetrics.frame.size.width)
228+
? m_layoutMetrics.frame.size.width
229+
: stateData.getContentSize().width;
227230
this->getLocalRootArkUINode().setContentSize(
228-
{static_cast<float>(stateData.getContentSize().width), static_cast<float>(tempHeight)});
231+
{tempWidth, tempHeight});
229232
DLOG(INFO) << "SpringScrollViewComponentInstance onStateChanged content_h:" << stateData.getContentSize().height
230233
<< " content_w:" << stateData.getContentSize().width << " h:"<<m_layoutMetrics.frame.size.height << " w:" << m_layoutMetrics.frame.size.width;
231234
if(!this->firstShowUI){

0 commit comments

Comments
 (0)