issueNo: I4DRLI

Description: fix the bug of list component.
Feature or Bugfix:Bugfix
Binary Source:No

Signed-off-by: youzhi92 <chenyouzhi@huawei.com>
Change-Id: I0153c94f8319f02d923f5f69ca34c48f412c4748
This commit is contained in:
youzhi92
2021-10-13 19:33:40 +08:00
parent 6f1c8244a7
commit fb52c12f91
2 changed files with 5 additions and 1 deletions
@@ -138,7 +138,10 @@ void ListComponent::OnViewAttached()
adapter_.UpdateContentAlignParam(listParameter);
adapter_.SetDirection(list_.GetDirection());
// Step4. add children to list dynamically.
list_.SetAdapter(&adapter_);
if (!hasSetAdaptor_) {
list_.SetAdapter(&adapter_);
hasSetAdaptor_ = true;
}
}
bool ListComponent::UpdateForView()
@@ -43,6 +43,7 @@ private:
UIList list_;
ListAdapter adapter_;
ListEventListener listEventListener_;
bool hasSetAdaptor_ = false;
static const char * const FUNC_SCROLLTO;
static const char * const INDEX_SCROLLTO;
static JSValue ListScrollTo(const JSValue func, const JSValue dom, const JSValue args[], const jerry_length_t size);