Skip to content

Commit e46e11b

Browse files
authored
fix:修复折叠屏屏幕自适应问题 (#31)
Signed-off-by: wupingyuan <wupingyuan2@h-partners.com>
1 parent a4c5a8a commit e46e11b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,13 @@ void SpringScrollViewComponentInstance::onStateChanged(SharedConcreteState const
226226
: stateData.getContentSize().height;
227227
this->getLocalRootArkUINode().setContentSize(
228228
{static_cast<float>(stateData.getContentSize().width), static_cast<float>(tempHeight)});
229-
DLOG(INFO) << "SpringScrollViewComponentInstance onStateChanged h:" << tempHeight
230-
<< " w:" << m_layoutMetrics.frame.size.width;
229+
DLOG(INFO) << "SpringScrollViewComponentInstance onStateChanged content_h:" << stateData.getContentSize().height
230+
<< " content_w:" << stateData.getContentSize().width << " h:"<<m_layoutMetrics.frame.size.height << " w:" << m_layoutMetrics.frame.size.width;
231+
if(!this->firstShowUI){
232+
this->getLocalRootArkUINode().setChildHeight(m_layoutMetrics.frame.size.height);
233+
this->getLocalRootArkUINode().setChildWidth(m_layoutMetrics.frame.size.width);
234+
}
235+
this->firstShowUI = false;
231236
}
232237

233238
bool SpringScrollViewComponentInstance::isHandlingTouches() const { return this->swiperStatus; }

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class SpringScrollViewComponentInstance : public CppComponentInstance<facebook::
5656
facebook::react::Size m_containerSize;
5757
facebook::react::Size m_contentSize;
5858
std::weak_ptr<NativeAnimatedTurboModule> m_springNativeAnimatedTurboModule{};
59+
bool firstShowUI = true;
5960
public:
6061
SpringScrollViewComponentInstance(Context context);
6162
void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override;

0 commit comments

Comments
 (0)