@@ -24,48 +24,45 @@ namespace rnoh {
24
24
25
25
ArkUI_NumberValue heightArray[] = {{.f32 = 45 }};
26
26
ArkUI_AttributeItem heightValue[] = {heightArray, 1 };
27
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_HEIGHT, heightValue);
27
+ NativeNodeApi::getInstance ()->setAttribute (imageStack. getArkUINodeHandle () , NODE_HEIGHT, heightValue);
28
28
ArkUI_NumberValue widthArray[] = {{.f32 = 45 }};
29
29
ArkUI_AttributeItem widthValue[] = {widthArray, 1 };
30
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_WIDTH, widthValue);
31
-
32
- ArkUI_NumberValue borderStyArray[] = {1 };
30
+ NativeNodeApi::getInstance ()->setAttribute (imageStack. getArkUINodeHandle () , NODE_WIDTH, widthValue);
31
+
32
+ ArkUI_NumberValue borderStyArray[] = {0.2 };
33
33
ArkUI_AttributeItem borderStyValue[] = {borderStyArray, 1 };
34
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_BORDER_WIDTH, borderStyValue);
34
+ NativeNodeApi::getInstance ()->setAttribute (imageStack. getArkUINodeHandle () , NODE_BORDER_WIDTH, borderStyValue);
35
35
36
36
ArkUI_NumberValue radiusArray[] = {{.f32 = 45 }};
37
37
ArkUI_AttributeItem radiusValue[] = {radiusArray, 1 };
38
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_BORDER_RADIUS, radiusValue);
39
-
38
+ NativeNodeApi::getInstance ()->setAttribute (imageStack. getArkUINodeHandle () , NODE_BORDER_RADIUS, radiusValue);
39
+ imageStack. setBackgroundColor ( 0xFFfafafa );
40
40
ArkUI_NumberValue borderColorArray[] = {
41
41
{.u32 = 0xFFaaaaaa }, {.u32 = 0xFFaaaaaa }, {.u32 = 0xFFaaaaaa }, {.u32 = 0xFFaaaaaa }, {.u32 = 0xFFaaaaaa }};
42
42
ArkUI_AttributeItem borderColorValue[] = {borderColorArray, 4 };
43
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_BORDER_COLOR, borderColorValue);
43
+ NativeNodeApi::getInstance ()->setAttribute (imageStack.getArkUINodeHandle (), NODE_BORDER_COLOR,
44
+ borderColorValue);
44
45
45
46
uint32_t shadowColorValue = 0xffaaaaaa ;
46
- uint32_t alpha = static_cast <uint32_t >((float )(shadowColorValue >> 24 & (0xff ))* 1.0 );
47
+ uint32_t alpha = static_cast <uint32_t >((float )(shadowColorValue >> 24 & (0xff )) * 1.0 );
47
48
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
-
49
+ ArkUI_NumberValue shadowValue[] = {
50
+ {.f32 = 2 }, {.i32 = 0 }, {.f32 = 1 }, {.f32 = 1 }, {.i32 = 0 }, {.u32 = shadowColorValue}, {.u32 = 0 }};
51
+ ArkUI_AttributeItem shadowItem = {.value = shadowValue,
52
+ .size = sizeof (shadowValue) / sizeof (ArkUI_NumberValue)};
53
+ NativeNodeApi::getInstance ()->setAttribute (imageStack.getArkUINodeHandle (), NODE_CUSTOM_SHADOW, &shadowItem);
54
+
60
55
ArkUI_NumberValue z_indexArray[] = {{.f32 = 1000 }};
61
56
ArkUI_AttributeItem z_indexValue[] = {z_indexArray, 1 };
62
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_Z_INDEX, z_indexValue);
57
+ NativeNodeApi::getInstance ()->setAttribute (imageStack. getArkUINodeHandle () , NODE_Z_INDEX, z_indexValue);
63
58
64
- NativeNodeApi::getInstance ()->insertChildAt (imageStack, progressNode.getArkUINodeHandle (), 0 );
65
- NativeNodeApi::getInstance ()->insertChildAt (arkUI_Node->getArkUINodeHandle (), imageStack, index );
59
+ NativeNodeApi::getInstance ()->insertChildAt (imageStack.getArkUINodeHandle (), progressNode.getArkUINodeHandle (),
60
+ 0 );
61
+ NativeNodeApi::getInstance ()->insertChildAt (arkUI_Node->getArkUINodeHandle (), imageStack.getArkUINodeHandle (),
62
+ index );
66
63
ArkUI_NumberValue positionArray[] = {{.f32 = static_cast <float >((screenWidth - 46 ) / 2.0 )}, {.f32 = -46 }};
67
64
ArkUI_AttributeItem positionValue[] = {positionArray, 2 };
68
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_POSITION, positionValue);
65
+ NativeNodeApi::getInstance ()->setAttribute (imageStack. getArkUINodeHandle () , NODE_POSITION, positionValue);
69
66
}
70
67
71
68
void RNCMaterialHeaderComponentInstance::onHeaderMove (float dur) {
@@ -74,7 +71,7 @@ namespace rnoh {
74
71
}
75
72
ArkUI_NumberValue positionArray[] = {{.f32 = static_cast <float >((mWindowWidth - 46 ) / 2.0 )}, {.f32 = dur - 46 }};
76
73
ArkUI_AttributeItem positionValue[] = {positionArray, 2 };
77
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_POSITION, positionValue);
74
+ NativeNodeApi::getInstance ()->setAttribute (imageStack. getArkUINodeHandle () , NODE_POSITION, positionValue);
78
75
}
79
76
void RNCMaterialHeaderComponentInstance::setScaleAnimate (int32_t dur) {
80
77
@@ -83,15 +80,30 @@ namespace rnoh {
83
80
float value = 1.0 - static_cast <float >(v);
84
81
ArkUI_NumberValue scaleArray[] = {{.f32 = value}, {.f32 = value}};
85
82
ArkUI_AttributeItem scaleValue[] = {scaleArray, 2 };
86
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_SCALE, scaleValue);
83
+ NativeNodeApi::getInstance ()->setAttribute (imageStack. getArkUINodeHandle () , NODE_SCALE, scaleValue);
87
84
if (std::abs (value - 0.01 ) < 1e-6 ) {
88
85
ArkUI_NumberValue scaleArray[] = {{.f32 = 1.0 }, {.f32 = 1.0 }};
89
86
ArkUI_AttributeItem scaleValue[] = {scaleArray, 2 };
90
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_SCALE, scaleValue);
87
+ NativeNodeApi::getInstance ()->setAttribute (imageStack. getArkUINodeHandle () , NODE_SCALE, scaleValue);
91
88
}
92
89
});
93
90
task->execute ();
94
91
}
92
+
93
+ void RNCMaterialHeaderComponentInstance::finalizeUpdates () {
94
+ auto rnInstancePtr = this ->m_deps ->rnInstance .lock ();
95
+ if (rnInstancePtr != nullptr ) {
96
+ auto turboModule = rnInstancePtr->getTurboModule (" RNCSmartRefreshContext" );
97
+ auto arkTsTurboModule = std::dynamic_pointer_cast<rnoh::ArkTSTurboModule>(turboModule);
98
+ folly::dynamic result = arkTsTurboModule->callSync (" cvp2px" , {getLayoutMetrics ().frame .size .width });
99
+ folly::dynamic result1 = arkTsTurboModule->callSync (" cvp2px" , {60 });
100
+ m_stackNode.setLayoutRect ({0 , 0 }, {result[" values" ].asDouble (), result1[" values" ].asDouble ()}, 1.0 );
101
+ }
102
+ m_stackNode.setAlignment (ARKUI_ALIGNMENT_BOTTOM);
103
+ }
104
+
105
+ facebook::react::SharedColor RNCMaterialHeaderComponentInstance::GetPrimaryColor () { return -1 ; }
106
+
95
107
void RNCMaterialHeaderComponentInstance::onChildInserted (ComponentInstance::Shared const &childComponentInstance,
96
108
std::size_t index) {
97
109
CppComponentInstance::onChildInserted (childComponentInstance, index );
@@ -115,7 +127,7 @@ namespace rnoh {
115
127
float y = -46.0 ;
116
128
ArkUI_NumberValue positionArray[] = {{.f32 = x}, {.f32 = y}};
117
129
ArkUI_AttributeItem positionValue[] = {positionArray, 2 };
118
- NativeNodeApi::getInstance ()->setAttribute (imageStack, NODE_POSITION, positionValue);
130
+ NativeNodeApi::getInstance ()->setAttribute (imageStack. getArkUINodeHandle () , NODE_POSITION, positionValue);
119
131
}
120
132
case IS_PULL_DOWN_1:
121
133
case IS_PULL_DOWN_2: {
0 commit comments