Skip to content

Commit 4fcf119

Browse files
committed
solve question:the refresh component header cannot be retracted
1 parent eb62e0b commit 4fcf119

File tree

7 files changed

+27
-18
lines changed

7 files changed

+27
-18
lines changed

harmony/smart_refresh_layout.har

188 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default class BuildProfile {
2-
static readonly HAR_VERSION = '0.6.7-0.2.6';
2+
static readonly HAR_VERSION = '0.6.7-0.2.7';
33
static readonly BUILD_MODE_NAME = 'debug';
44
static readonly DEBUG = true;
55
}

harmony/smart_refresh_layout/oh-package.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "@react-native-oh-tpl/react-native-smartrefreshlayout",
77
"description": "Please describe the basic information.",
88
"main": "index.ets",
9-
"version": "0.6.7-0.2.6",
9+
"version": "0.6.7-0.2.7",
1010
"dependencies": {
1111
"@rnoh/react-native-openharmony": "file:../react_native_openharmony"
1212
},

harmony/smart_refresh_layout/src/main/cpp/RNCMaterialHeaderComponentInstance.cpp

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,14 @@ namespace rnoh {
2121
progressNode.setLoadingProgressNodeColor(0x53658461);
2222
progressNode.setLoadingProgressNodeAnimating(true);
2323
progressNode.setSize({45, 45});
24-
25-
imageStack = NativeNodeApi::getInstance()->createNode(ARKUI_NODE_STACK);
26-
24+
2725
ArkUI_NumberValue heightArray[] = {{.f32 = 45}};
2826
ArkUI_AttributeItem heightValue[] = {heightArray, 1};
2927
NativeNodeApi::getInstance()->setAttribute(imageStack, NODE_HEIGHT, heightValue);
3028
ArkUI_NumberValue widthArray[] = {{.f32 = 45}};
3129
ArkUI_AttributeItem widthValue[] = {widthArray, 1};
3230
NativeNodeApi::getInstance()->setAttribute(imageStack, NODE_WIDTH, widthValue);
33-
34-
ArkUI_NumberValue shadowArray[] = {{.i32 = ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG}};
35-
ArkUI_AttributeItem shadowValue[] = {shadowArray, 1};
36-
NativeNodeApi::getInstance()->setAttribute(imageStack, NODE_SHADOW, shadowValue);
37-
31+
3832
ArkUI_NumberValue borderStyArray[] = {1};
3933
ArkUI_AttributeItem borderStyValue[] = {borderStyArray, 1};
4034
NativeNodeApi::getInstance()->setAttribute(imageStack, NODE_BORDER_WIDTH, borderStyValue);
@@ -48,13 +42,28 @@ namespace rnoh {
4842
ArkUI_AttributeItem borderColorValue[] = {borderColorArray, 4};
4943
NativeNodeApi::getInstance()->setAttribute(imageStack, NODE_BORDER_COLOR, borderColorValue);
5044

45+
uint32_t shadowColorValue = 0xffaaaaaa;
46+
uint32_t alpha = static_cast<uint32_t>((float)(shadowColorValue >> 24 & (0xff))*1.0);
47+
shadowColorValue = (alpha << 24) + (shadowColorValue & 0xffffff);
48+
ArkUI_NumberValue shadowValue[] = {
49+
{.f32 = 2},
50+
{.i32 = 0},
51+
{.f32 = 1},
52+
{.f32 = 1},
53+
{.i32 = 0},
54+
{.u32 = shadowColorValue},
55+
{.u32 = 0}
56+
};
57+
ArkUI_AttributeItem shadowItem[] = {.value = shadowValue,.size = sizeof(shadowValue)/sizeof(ArkUI_NumberValue)};
58+
NativeNodeApi::getInstance()->setAttribute(imageStack, NODE_CUSTOM_SHADOW, &shadowItem);
59+
5160
ArkUI_NumberValue z_indexArray[] = {{.f32 = 1000}};
5261
ArkUI_AttributeItem z_indexValue[] = {z_indexArray, 1};
5362
NativeNodeApi::getInstance()->setAttribute(imageStack, NODE_Z_INDEX, z_indexValue);
5463

5564
NativeNodeApi::getInstance()->insertChildAt(imageStack, progressNode.getArkUINodeHandle(), 0);
5665
NativeNodeApi::getInstance()->insertChildAt(arkUI_Node->getArkUINodeHandle(), imageStack, index);
57-
ArkUI_NumberValue positionArray[] = {{.f32 = static_cast<float>((screenWidth - 45) / 2.0)}, {.f32 = -45}};
66+
ArkUI_NumberValue positionArray[] = {{.f32 = static_cast<float>((screenWidth - 46) / 2.0)}, {.f32 = -46}};
5867
ArkUI_AttributeItem positionValue[] = {positionArray, 2};
5968
NativeNodeApi::getInstance()->setAttribute(imageStack, NODE_POSITION, positionValue);
6069
}
@@ -63,7 +72,7 @@ namespace rnoh {
6372
if (isRefreshed) {
6473
return;
6574
}
66-
ArkUI_NumberValue positionArray[] = {{.f32 = static_cast<float>((mWindowWidth - 45) / 2.0)}, {.f32 = dur - 45}};
75+
ArkUI_NumberValue positionArray[] = {{.f32 = static_cast<float>((mWindowWidth - 46) / 2.0)}, {.f32 = dur - 46}};
6776
ArkUI_AttributeItem positionValue[] = {positionArray, 2};
6877
NativeNodeApi::getInstance()->setAttribute(imageStack, NODE_POSITION, positionValue);
6978
}
@@ -102,8 +111,8 @@ namespace rnoh {
102111
switch (status) {
103112
case IS_FREE:
104113
{
105-
float x = static_cast<float>((mWindowWidth - 45) / 2.0);
106-
float y = -45.0;
114+
float x = static_cast<float>((mWindowWidth - 46) / 2.0);
115+
float y = -46.0;
107116
ArkUI_NumberValue positionArray[] = {{.f32 = x}, {.f32 = y}};
108117
ArkUI_AttributeItem positionValue[] = {positionArray, 2};
109118
NativeNodeApi::getInstance()->setAttribute(imageStack, NODE_POSITION, positionValue);

harmony/smart_refresh_layout/src/main/cpp/RNCMaterialHeaderComponentInstance.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace rnoh {
1919

2020
private:
2121
StackNode m_stackNode;
22-
ArkUI_NodeHandle imageStack;
22+
ArkUI_NodeHandle imageStack{m_stackNode.getArkUINodeHandle()};
2323
LoadingProgressNode progressNode;
2424
float mWindowWidth{0.0};
2525
bool isRefreshed{false};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ namespace rnoh {
7171
auto panGesture = gestureApi->createPanGesture(1, GESTURE_DIRECTION_VERTICAL, 5);
7272
auto onPanActionCallBack = [](ArkUI_GestureEvent *event, void *extraParam) {
7373
SmartRefreshLayoutComponentInstance *instance = (SmartRefreshLayoutComponentInstance *)extraParam;
74-
if (!instance->m_pullToRefreshNode.getPullToRefreshConfigurator().getHasRefresh() ||
75-
!instance->isComponentTop()) {
74+
if (!instance->m_pullToRefreshNode.getPullToRefreshConfigurator().getHasRefresh()) {
7675
return;
7776
}
7877
ArkUI_GestureEventActionType actionType = OH_ArkUI_GestureEvent_GetActionType(event);
7978
if (actionType == GESTURE_EVENT_ACTION_ACCEPT) {
8079
instance->offsetY = 0;
8180
instance->downY = OH_ArkUI_PanGesture_GetOffsetY(event);
8281
instance->touchYOld = instance->offsetY;
82+
instance->onPullDownToRefresh();
8383
} else if (actionType == GESTURE_EVENT_ACTION_UPDATE) {
8484
instance->offsetY = OH_ArkUI_PanGesture_GetOffsetY(event) - instance->downY;
8585
if (instance->offsetY >= 0) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-native-oh-tpl/react-native-smartrefreshlayout",
3-
"version": "0.6.7-0.2.6",
3+
"version": "0.6.7-0.2.7",
44
"description": "基于android SmartRefreshLayout的封装",
55
"harmony": {
66
"alias": "react-native-smartrefreshlayout"

0 commit comments

Comments
 (0)