Skip to content

Commit eb62e0b

Browse files
committed
solve question: the AnyHeader set height 0
1 parent a44088f commit eb62e0b

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default class BuildProfile {
2+
static readonly HAR_VERSION = '0.6.7-0.2.6';
3+
static readonly BUILD_MODE_NAME = 'debug';
4+
static readonly DEBUG = true;
5+
}

harmony/smart_refresh_layout/src/main/cpp/PullToRefreshNode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ namespace rnoh {
77
PullToRefreshNode::PullToRefreshNode()
88
: ArkUINode(NativeNodeApi::getInstance()->createNode(ArkUI_NodeType::ARKUI_NODE_COLUMN)),
99
m_headerArkUINodeHandle(nullptr), m_listArkUINodeHandle(nullptr), m_pullToRefreshNodeDelegate(nullptr) {
10-
ArkUI_NumberValue columnFlexValue[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_CENTER}};
11-
ArkUI_AttributeItem columnFlexItem = {columnFlexValue, sizeof(columnFlexValue) / sizeof(ArkUI_NumberValue)};
12-
NativeNodeApi::getInstance()->setAttribute(m_nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT, &columnFlexItem);
10+
// ArkUI_NumberValue columnFlexValue[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_CENTER}};
11+
// ArkUI_AttributeItem columnFlexItem = {columnFlexValue, sizeof(columnFlexValue) / sizeof(ArkUI_NumberValue)};
12+
// NativeNodeApi::getInstance()->setAttribute(m_nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT, &columnFlexItem);
1313
}
1414

1515
PullToRefreshNode::~PullToRefreshNode() {}

harmony/smart_refresh_layout/src/main/cpp/SmartRefreshLayoutComponentInstance.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,27 @@ namespace rnoh {
3131
void SmartRefreshLayoutComponentInstance::onChildInserted(ComponentInstance::Shared const &childComponentInstance,
3232
std::size_t index) {
3333
CppComponentInstance::onChildInserted(childComponentInstance, index);
34+
35+
mWidth = childComponentInstance->getLayoutMetrics().frame.size.width;
3436
if (!isHeaderInserted) {
37+
std::vector<ComponentInstance::Shared> child = childComponentInstance->getChildren();
38+
float childHeight = 0.0;
39+
for (ComponentInstance::Shared c : child) {
40+
if (c) {
41+
auto height = c->getLayoutMetrics().frame.size.height;
42+
if (height>childHeight) {
43+
childHeight = height;
44+
}
45+
}
46+
}
47+
childComponentInstance->getLocalRootArkUINode().setSize(facebook::react::Size({mWidth, childHeight}));
3548
m_headerStackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
3649

3750
isHeaderInserted = true;
3851
} else {
3952
m_listStackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
4053
}
41-
auto nodeValue =
42-
NativeNodeApi::getInstance()->getAttribute(m_pullToRefreshNode.getArkUINodeHandle(), NODE_WIDTH);
43-
mWidth = nodeValue->value[nodeValue->size - 1].f32;
54+
4455
m_headerStackNode.setSize(facebook::react::Size({mWidth, 0}));
4556
setOtherHeaderDelegate();
4657
}

0 commit comments

Comments
 (0)