@react-native-ohos/react-native-bindingx 1.0.4-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +13 -0
- package/README.OpenSource +11 -0
- package/README.md +14 -0
- package/harmony/bindingx/BuildProfile.ets +5 -0
- package/harmony/bindingx/build-profile.json5 +9 -0
- package/harmony/bindingx/hvigorfile.ts +2 -0
- package/harmony/bindingx/index.ets +25 -0
- package/harmony/bindingx/oh-package.json5 +12 -0
- package/harmony/bindingx/src/main/cpp/CMakeLists.txt +8 -0
- package/harmony/bindingx/src/main/cpp/ExpressHandleEval.cpp +176 -0
- package/harmony/bindingx/src/main/cpp/ExpressHandleEval.h +51 -0
- package/harmony/bindingx/src/main/cpp/ReactBindingXModule.cpp +42 -0
- package/harmony/bindingx/src/main/cpp/ReactBindingXModule.h +38 -0
- package/harmony/bindingx/src/main/cpp/ReactBindingXPackage.cpp +53 -0
- package/harmony/bindingx/src/main/cpp/ReactBindingXPackage.h +37 -0
- package/harmony/bindingx/src/main/cpp/ReactBindingxArkTSMessageHandler.cpp +563 -0
- package/harmony/bindingx/src/main/cpp/ReactBindingxArkTSMessageHandler.h +78 -0
- package/harmony/bindingx/src/main/ets/BindingXCore.ts +477 -0
- package/harmony/bindingx/src/main/ets/BindingXParamBean.ts +37 -0
- package/harmony/bindingx/src/main/ets/IRNViewUpdater.ts +45 -0
- package/harmony/bindingx/src/main/ets/ReactBindingXModule.ts +71 -0
- package/harmony/bindingx/src/main/ets/ReactBindingXPackage.ts +46 -0
- package/harmony/bindingx/src/main/ets/TimingFunctions.ts +281 -0
- package/harmony/bindingx/src/main/ets/TimingFunctionsType.ts +58 -0
- package/harmony/bindingx/src/main/ets/TimingFunctionsTypeHandler.ts +128 -0
- package/harmony/bindingx/src/main/module.json5 +7 -0
- package/harmony/bindingx/src/main/resources/base/element/color.json +8 -0
- package/harmony/bindingx/src/main/resources/base/element/string.json +16 -0
- package/harmony/bindingx/src/main/resources/base/media/icon.png +0 -0
- package/harmony/bindingx/src/main/resources/base/profile/main_pages.json +5 -0
- package/harmony/bindingx/src/main/resources/en_US/element/string.json +16 -0
- package/harmony/bindingx/src/main/resources/zh_CN/element/string.json +16 -0
- package/harmony/bindingx/ts.ts +26 -0
- package/harmony/bindingx.har +0 -0
- package/lib/index.js +3 -0
- package/lib/specs/NativeReactBindingXModule.ts +12 -0
- package/lib/src/bindingx.js +131 -0
- package/package.json +27 -0
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
#include "ReactBindingxArkTSMessageHandler.h"
|
|
25
|
+
#include <string>
|
|
26
|
+
#include <vector>
|
|
27
|
+
|
|
28
|
+
namespace rnoh
|
|
29
|
+
{
|
|
30
|
+
|
|
31
|
+
double scrollEvalValue;
|
|
32
|
+
ReactBindingxArkTSMessageHandler *m_reactBindingxArkTSMessageHandler;
|
|
33
|
+
|
|
34
|
+
int hex_char_value(char c)
|
|
35
|
+
{
|
|
36
|
+
if (c >= '0' && c <= '9')
|
|
37
|
+
return c - '0';
|
|
38
|
+
else if (c >= 'a' && c <= 'f')
|
|
39
|
+
return (c - 'a' + 10);
|
|
40
|
+
else if (c >= 'A' && c <= 'F')
|
|
41
|
+
return (c - 'A' + 10);
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
int hex_to_decimal(const char *szHex, int len)
|
|
45
|
+
{
|
|
46
|
+
int result = 0;
|
|
47
|
+
for (int i = 0; i < len; i++)
|
|
48
|
+
{
|
|
49
|
+
result += (int)pow((float)16, (int)len - i - 1) * hex_char_value(szHex[i]);
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
int evaluate(float fraction, int startValue, int endValue)
|
|
54
|
+
{
|
|
55
|
+
int startInt = startValue;
|
|
56
|
+
float startA = ((startInt >> 24) & 0xff) / 255.0;
|
|
57
|
+
float startR = ((startInt >> 16) & 0xff) / 255.0;
|
|
58
|
+
float startG = ((startInt >> 8) & 0xff) / 255.0;
|
|
59
|
+
float startB = (startInt & 0xff) / 255.0;
|
|
60
|
+
|
|
61
|
+
int endInt = endValue;
|
|
62
|
+
float endA = ((endInt >> 24) & 0xff) / 255.0;
|
|
63
|
+
float endR = ((endInt >> 16) & 0xff) / 255.0;
|
|
64
|
+
float endG = ((endInt >> 8) & 0xff) / 255.0;
|
|
65
|
+
float endB = (endInt & 0xff) / 255.0;
|
|
66
|
+
|
|
67
|
+
startR = pow(startR, 2.2);
|
|
68
|
+
startG = pow(startG, 2.2);
|
|
69
|
+
startB = pow(startB, 2.2);
|
|
70
|
+
|
|
71
|
+
endR = pow(endR, 2.2);
|
|
72
|
+
endG = pow(endG, 2.2);
|
|
73
|
+
endB = pow(endB, 2.2);
|
|
74
|
+
float a = startA + fraction * (endA - startA);
|
|
75
|
+
float r = startR + fraction * (endR - startR);
|
|
76
|
+
float g = startG + fraction * (endG - startG);
|
|
77
|
+
float b = startB + fraction * (endB - startB);
|
|
78
|
+
a = a * 255.0;
|
|
79
|
+
r = pow(r, 1.0 / 2.2) * 255.0;
|
|
80
|
+
g = pow(g, 1.0 / 2.2) * 255.0;
|
|
81
|
+
b = pow(b, 1.0 / 2.2) * 255.0;
|
|
82
|
+
|
|
83
|
+
int ra = round(a);
|
|
84
|
+
int rr = round(r);
|
|
85
|
+
int rg = round(g);
|
|
86
|
+
int rb = round(b);
|
|
87
|
+
return ra << 24 | rr << 16 | rg << 8 | rb;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
int minNum(int a, int b) { return a > b ? b : a; }
|
|
91
|
+
|
|
92
|
+
std::vector<std::string> split(const std::string &src, const std::string &sep)
|
|
93
|
+
{
|
|
94
|
+
std::vector<std::string> tokens;
|
|
95
|
+
int lastPos = 0,
|
|
96
|
+
index, sepLen = sep.length();
|
|
97
|
+
while (-1 != (index = src.find(sep, lastPos)))
|
|
98
|
+
{
|
|
99
|
+
tokens.push_back(src.substr(lastPos, index - lastPos));
|
|
100
|
+
lastPos = index + sepLen;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
std::string lastString = src.substr(lastPos);
|
|
104
|
+
if (!lastString.empty())
|
|
105
|
+
{
|
|
106
|
+
tokens.push_back(lastString);
|
|
107
|
+
}
|
|
108
|
+
return tokens;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
std::vector<std::string> findProperty(std::vector<std::string> propertyWords, std::vector<std::string> propertyAtr)
|
|
112
|
+
{
|
|
113
|
+
std::vector<std::string> result;
|
|
114
|
+
for (int i = 0; i < propertyAtr.size(); i++)
|
|
115
|
+
{
|
|
116
|
+
auto temp = propertyAtr[i];
|
|
117
|
+
for (int j = 0; j < propertyWords.size(); j++)
|
|
118
|
+
{
|
|
119
|
+
if (temp == propertyWords[j])
|
|
120
|
+
{
|
|
121
|
+
result.push_back(temp);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
void ReactBindingxArkTSMessageHandler::handleScroll()
|
|
129
|
+
{
|
|
130
|
+
auto panActionCallBack = ReactBindingxArkTSMessageHandler::getInstance()->m_panActionCallBack;
|
|
131
|
+
auto scrollViewComponentInstance =
|
|
132
|
+
std::dynamic_pointer_cast<rnoh::ScrollViewComponentInstance>(panActionCallBack->componentInstance);
|
|
133
|
+
|
|
134
|
+
float scrollY = scrollViewComponentInstance->getScrollViewMetrics().contentOffset.y;
|
|
135
|
+
if (this->m_scrollY != scrollY)
|
|
136
|
+
{
|
|
137
|
+
this->m_scrollY = scrollY;
|
|
138
|
+
}
|
|
139
|
+
if (this->m_scrollY <= 0)
|
|
140
|
+
{
|
|
141
|
+
this->m_scrollY = 1;
|
|
142
|
+
panActionCallBack->angle = 1;
|
|
143
|
+
}
|
|
144
|
+
std::vector<std::string> roateMatchPropertys;
|
|
145
|
+
roateMatchPropertys.push_back("transform.rotate");
|
|
146
|
+
roateMatchPropertys.push_back("transform.rotateZ");
|
|
147
|
+
roateMatchPropertys.push_back("transform.rotateX");
|
|
148
|
+
roateMatchPropertys.push_back("transform.rotateY");
|
|
149
|
+
std::vector<std::string> findRoateAtr = findProperty(roateMatchPropertys, panActionCallBack->propertyAtr);
|
|
150
|
+
if (findRoateAtr.size() > 0)
|
|
151
|
+
{
|
|
152
|
+
ArkUI_NumberValue roateValue[] = {
|
|
153
|
+
{.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = static_cast<float>(this->m_scrollY)}, {.f32 = 0}};
|
|
154
|
+
ArkUI_AttributeItem roateItem = {roateValue, sizeof(roateValue) / sizeof(ArkUI_NumberValue)};
|
|
155
|
+
NativeNodeApi::getInstance()->setAttribute(
|
|
156
|
+
panActionCallBack->elementViewComponentInstance->getLocalRootArkUINode().getArkUINodeHandle(),
|
|
157
|
+
NODE_ROTATE, &roateItem);
|
|
158
|
+
}
|
|
159
|
+
DLOG(INFO) << "ReactBindingXPackage::scroll getScrollViewMetrics y:" << this->m_scrollY
|
|
160
|
+
<< " scrollY:" << panActionCallBack->scrollY << " angle:" << panActionCallBack->angle
|
|
161
|
+
<< " width:" << scrollViewComponentInstance->getLayoutMetrics().frame.size.width;
|
|
162
|
+
float translate = this->m_scrollY;
|
|
163
|
+
std::array<ArkUI_NumberValue, 3> translateValue = {ArkUI_NumberValue{.f32 = translate}, {.f32 = 0}, {.f32 = 0}};
|
|
164
|
+
ArkUI_AttributeItem translateItem = {translateValue.data(), translateValue.size()};
|
|
165
|
+
NativeNodeApi::getInstance()->setAttribute(
|
|
166
|
+
panActionCallBack->elementViewComponentInstance->getLocalRootArkUINode().getArkUINodeHandle(),
|
|
167
|
+
NODE_TRANSLATE, &translateItem);
|
|
168
|
+
|
|
169
|
+
if (panActionCallBack->scrollY != this->m_scrollY)
|
|
170
|
+
{
|
|
171
|
+
if (panActionCallBack->scrollY > this->m_scrollY)
|
|
172
|
+
{
|
|
173
|
+
panActionCallBack->angle = this->m_scrollY * 0.03;
|
|
174
|
+
}
|
|
175
|
+
else
|
|
176
|
+
{
|
|
177
|
+
panActionCallBack->angle = this->m_scrollY * 0.03;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
panActionCallBack->scrollY = this->m_scrollY;
|
|
181
|
+
|
|
182
|
+
std::vector<std::string> backgroundColorMatchPropertys;
|
|
183
|
+
backgroundColorMatchPropertys.push_back("background-color");
|
|
184
|
+
std::vector<std::string> findbackgroundColorAtr =
|
|
185
|
+
findProperty(backgroundColorMatchPropertys, panActionCallBack->propertyAtr);
|
|
186
|
+
if (findbackgroundColorAtr.size() > 0 && panActionCallBack->backgroundcolor.c_str() != nullptr)
|
|
187
|
+
{
|
|
188
|
+
auto backgroundcolorAtr = split(panActionCallBack->backgroundcolor, ",");
|
|
189
|
+
if (panActionCallBack->angle < 1)
|
|
190
|
+
{
|
|
191
|
+
panActionCallBack->angle = 1;
|
|
192
|
+
std::string color = backgroundcolorAtr[0];
|
|
193
|
+
int color1 = hex_to_decimal(color.c_str(), color.size());
|
|
194
|
+
panActionCallBack->elementViewComponentInstance->getLocalRootArkUINode().setBackgroundColor(color1);
|
|
195
|
+
}
|
|
196
|
+
else
|
|
197
|
+
{
|
|
198
|
+
std::string color = backgroundcolorAtr[0];
|
|
199
|
+
int color1 = hex_to_decimal(color.c_str(), color.size());
|
|
200
|
+
std::string backgroundcolorEval = panActionCallBack->backgroundcolorEval;
|
|
201
|
+
auto backgroundcolorEvalTemp = backgroundcolorEval.replace(backgroundcolorEval.find("y"), 1,
|
|
202
|
+
std::to_string(panActionCallBack->scrollY));
|
|
203
|
+
backgroundcolorEval = backgroundcolorEvalTemp.substr(backgroundcolorEvalTemp.find("(") + 1,
|
|
204
|
+
backgroundcolorEvalTemp.find(")") -
|
|
205
|
+
backgroundcolorEvalTemp.find("(") - 1);
|
|
206
|
+
auto backgroundcolorEvalAtr = split(backgroundcolorEval, ",");
|
|
207
|
+
int num = minNum(atoi(backgroundcolorEvalAtr[0].c_str()), atoi(backgroundcolorEvalAtr[1].c_str()));
|
|
208
|
+
std::string oldMin = "min(" + backgroundcolorEvalAtr[0] + "," + backgroundcolorEvalAtr[1] + ")";
|
|
209
|
+
auto evalStr = backgroundcolorEvalTemp.replace(backgroundcolorEvalTemp.find(oldMin), oldMin.size(),
|
|
210
|
+
std::to_string(num));
|
|
211
|
+
ExpressHandleEval::getInstance()->init_mapping(ExpressHandleEval::getInstance()->op_mapping);
|
|
212
|
+
double fraction = ExpressHandleEval::getInstance()->eval(evalStr);
|
|
213
|
+
int color2 = hex_to_decimal(backgroundcolorAtr[1].c_str(), backgroundcolorAtr[1].size());
|
|
214
|
+
int bgcolor = evaluate(fraction, color1, color2);
|
|
215
|
+
panActionCallBack->elementViewComponentInstance->getLocalRootArkUINode().setBackgroundColor(bgcolor);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
std::vector<std::string> scaleMatchPropertys;
|
|
220
|
+
scaleMatchPropertys.push_back("transform.scale");
|
|
221
|
+
scaleMatchPropertys.push_back("transform.scaleX");
|
|
222
|
+
scaleMatchPropertys.push_back("transform.scaleY");
|
|
223
|
+
std::vector<std::string> findScaleAtr = findProperty(scaleMatchPropertys, panActionCallBack->propertyAtr);
|
|
224
|
+
if (findScaleAtr.size() > 0)
|
|
225
|
+
{
|
|
226
|
+
ArkUI_NumberValue scaleValue[] = {{.f32 = static_cast<float>((panActionCallBack->angle))},
|
|
227
|
+
{.f32 = static_cast<float>((panActionCallBack->angle))}};
|
|
228
|
+
ArkUI_AttributeItem scaleItem = {scaleValue, sizeof(scaleValue) / sizeof(ArkUI_NumberValue)};
|
|
229
|
+
NativeNodeApi::getInstance()->setAttribute(
|
|
230
|
+
panActionCallBack->elementViewComponentInstance->getLocalRootArkUINode().getArkUINodeHandle(),
|
|
231
|
+
NODE_SCALE, &scaleItem);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
void ReactBindingxArkTSMessageHandler::handleArkTSMessage(const Context &ctx)
|
|
236
|
+
{
|
|
237
|
+
auto rnInstance = ctx.rnInstance.lock();
|
|
238
|
+
if (!rnInstance)
|
|
239
|
+
return;
|
|
240
|
+
if (ctx.messageName == "prepare")
|
|
241
|
+
{
|
|
242
|
+
auto eventType = ctx.messagePayload["eventType"];
|
|
243
|
+
if (eventType == "pan")
|
|
244
|
+
{
|
|
245
|
+
auto maybeTag = ctx.messagePayload["anchor"];
|
|
246
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
|
247
|
+
auto componentInstance = rnInstanceCAPI->findComponentInstanceByTag(maybeTag.asDouble());
|
|
248
|
+
auto anyGestureApi =
|
|
249
|
+
OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_GESTURE, "ArkUI_NativeGestureAPI_1");
|
|
250
|
+
panGestureApi = reinterpret_cast<ArkUI_NativeGestureAPI_1 *>(anyGestureApi);
|
|
251
|
+
panPanGesture =
|
|
252
|
+
panGestureApi->createPanGesture(1, GESTURE_DIRECTION_HORIZONTAL | GESTURE_DIRECTION_VERTICAL, 0);
|
|
253
|
+
auto onPanActionCallBack = [](ArkUI_GestureEvent *event, void *extraParam)
|
|
254
|
+
{
|
|
255
|
+
if (ReactBindingxArkTSMessageHandler::getInstance()->isInterceptPan)
|
|
256
|
+
return;
|
|
257
|
+
PanActionCallBack *panActionCallBack = (PanActionCallBack *)extraParam;
|
|
258
|
+
ArkUI_GestureEventActionType actionType = OH_ArkUI_GestureEvent_GetActionType(event);
|
|
259
|
+
float x = OH_ArkUI_PanGesture_GetOffsetX(event);
|
|
260
|
+
float y = OH_ArkUI_PanGesture_GetOffsetY(event);
|
|
261
|
+
if (actionType == GESTURE_EVENT_ACTION_UPDATE)
|
|
262
|
+
{
|
|
263
|
+
panActionCallBack->offsetX = panActionCallBack->positionX + x;
|
|
264
|
+
panActionCallBack->offsetY = panActionCallBack->positionY + y;
|
|
265
|
+
std::array<ArkUI_NumberValue, 3> translateValue = {
|
|
266
|
+
ArkUI_NumberValue{.f32 = panActionCallBack->offsetX * panActionCallBack->px2vp},
|
|
267
|
+
{.f32 = panActionCallBack->offsetY * panActionCallBack->px2vp},
|
|
268
|
+
{.f32 = 0}};
|
|
269
|
+
ArkUI_AttributeItem translateItem = {translateValue.data(), translateValue.size()};
|
|
270
|
+
NativeNodeApi::getInstance()->setAttribute(
|
|
271
|
+
panActionCallBack->componentInstance->getLocalRootArkUINode().getArkUINodeHandle(),
|
|
272
|
+
NODE_TRANSLATE, &translateItem);
|
|
273
|
+
panActionCallBack->rnInstance.lock()->postMessageToArkTS("touch", to_string(panActionCallBack->offsetX * panActionCallBack->px2vp) + "," + to_string(panActionCallBack->offsetY * panActionCallBack->px2vp));
|
|
274
|
+
}
|
|
275
|
+
else if (actionType == GESTURE_EVENT_ACTION_END)
|
|
276
|
+
{
|
|
277
|
+
panActionCallBack->positionX = panActionCallBack->offsetX;
|
|
278
|
+
panActionCallBack->positionY = panActionCallBack->offsetY;
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
PanActionCallBack *panActionCallBack =
|
|
282
|
+
new PanActionCallBack{.componentInstance = componentInstance,
|
|
283
|
+
.px2vp = static_cast<float>(ctx.messagePayload["px2vp"].asDouble()),
|
|
284
|
+
.rnInstance = rnInstance};
|
|
285
|
+
panGestureApi->setGestureEventTarget(
|
|
286
|
+
panPanGesture, GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE | GESTURE_EVENT_ACTION_END,
|
|
287
|
+
panActionCallBack, onPanActionCallBack);
|
|
288
|
+
if (panGestureApi && componentInstance)
|
|
289
|
+
{
|
|
290
|
+
panGestureApi->addGestureToNode(componentInstance->getLocalRootArkUINode().getArkUINodeHandle(),
|
|
291
|
+
panPanGesture, PARALLEL, NORMAL_GESTURE_MASK);
|
|
292
|
+
ReactBindingxArkTSMessageHandler::getInstance()->isInterceptPan = true;
|
|
293
|
+
}
|
|
294
|
+
else if (!componentInstance)
|
|
295
|
+
{
|
|
296
|
+
DLOG(INFO) << "ReactBindingXPackage componentInstance is null";
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (ctx.messageName == "bind")
|
|
301
|
+
{
|
|
302
|
+
DLOG(INFO) << "ReactBindingXPackage::messagePayload:" << ctx.messagePayload;
|
|
303
|
+
auto eventType = (ctx.messagePayload["options"])["eventType"];
|
|
304
|
+
if (eventType == "orientation")
|
|
305
|
+
{
|
|
306
|
+
auto maybeTag = ((ctx.messagePayload["options"])["props"])[0]["element"];
|
|
307
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
|
308
|
+
auto componentInstance = rnInstanceCAPI->findComponentInstanceByTag(maybeTag.asDouble());
|
|
309
|
+
auto x = (ctx.messagePayload["data"])["x"].asDouble();
|
|
310
|
+
auto y = (ctx.messagePayload["data"])["y"].asDouble();
|
|
311
|
+
std::array<ArkUI_NumberValue, 3> translateValue = {
|
|
312
|
+
ArkUI_NumberValue{.f32 = static_cast<float>(x) * 100},
|
|
313
|
+
{.f32 = static_cast<float>(y) * 100},
|
|
314
|
+
{.f32 = 0}};
|
|
315
|
+
ArkUI_AttributeItem translateItem = {translateValue.data(), translateValue.size()};
|
|
316
|
+
NativeNodeApi::getInstance()->setAttribute(
|
|
317
|
+
componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), NODE_TRANSLATE,
|
|
318
|
+
&translateItem);
|
|
319
|
+
}
|
|
320
|
+
else if (eventType == "pan")
|
|
321
|
+
{
|
|
322
|
+
DLOG(INFO) << "ReactBindingXPackage bind :pan:" << ctx.messagePayload;
|
|
323
|
+
auto maybeTag = (ctx.messagePayload["options"])["anchor"];
|
|
324
|
+
DLOG(INFO) << " ReactBindingXPackage pan maybeTag:" << maybeTag.asDouble();
|
|
325
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
|
326
|
+
auto componentInstance = rnInstanceCAPI->findComponentInstanceByTag(maybeTag.asDouble());
|
|
327
|
+
auto anyGestureApi = OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_GESTURE, "ArkUI_NativeGestureAPI_1");
|
|
328
|
+
panGestureApi = reinterpret_cast<ArkUI_NativeGestureAPI_1 *>(anyGestureApi);
|
|
329
|
+
panPanGesture =
|
|
330
|
+
panGestureApi->createPanGesture(1, GESTURE_DIRECTION_HORIZONTAL | GESTURE_DIRECTION_VERTICAL, 0);
|
|
331
|
+
auto onPanActionCallBack = [](ArkUI_GestureEvent *event, void *extraParam)
|
|
332
|
+
{
|
|
333
|
+
if (ReactBindingxArkTSMessageHandler::getInstance()->isInterceptPan)
|
|
334
|
+
return;
|
|
335
|
+
PanActionCallBack *panActionCallBack = (PanActionCallBack *)extraParam;
|
|
336
|
+
ArkUI_GestureEventActionType actionType = OH_ArkUI_GestureEvent_GetActionType(event);
|
|
337
|
+
float x = OH_ArkUI_PanGesture_GetOffsetX(event);
|
|
338
|
+
float y = OH_ArkUI_PanGesture_GetOffsetY(event);
|
|
339
|
+
if (actionType == GESTURE_EVENT_ACTION_UPDATE)
|
|
340
|
+
{
|
|
341
|
+
panActionCallBack->offsetX = panActionCallBack->positionX + x;
|
|
342
|
+
panActionCallBack->offsetY = panActionCallBack->positionY + y;
|
|
343
|
+
std::array<ArkUI_NumberValue, 3> translateValue = {
|
|
344
|
+
ArkUI_NumberValue{.f32 = panActionCallBack->offsetX * panActionCallBack->px2vp},
|
|
345
|
+
{.f32 = panActionCallBack->offsetY * panActionCallBack->px2vp},
|
|
346
|
+
{.f32 = 0}};
|
|
347
|
+
ArkUI_AttributeItem translateItem = {translateValue.data(), translateValue.size()};
|
|
348
|
+
NativeNodeApi::getInstance()->setAttribute(
|
|
349
|
+
panActionCallBack->componentInstance->getLocalRootArkUINode().getArkUINodeHandle(),
|
|
350
|
+
NODE_TRANSLATE, &translateItem);
|
|
351
|
+
panActionCallBack->rnInstance.lock()->postMessageToArkTS(
|
|
352
|
+
"touch", to_string(panActionCallBack->offsetX * panActionCallBack->px2vp) + "," +
|
|
353
|
+
to_string(panActionCallBack->offsetY * panActionCallBack->px2vp));
|
|
354
|
+
}
|
|
355
|
+
else if (actionType == GESTURE_EVENT_ACTION_END)
|
|
356
|
+
{
|
|
357
|
+
panActionCallBack->positionX = panActionCallBack->offsetX;
|
|
358
|
+
panActionCallBack->positionY = panActionCallBack->offsetY;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
PanActionCallBack *panActionCallBack =
|
|
362
|
+
new PanActionCallBack{.componentInstance = componentInstance,
|
|
363
|
+
.px2vp = static_cast<float>(ctx.messagePayload["px2vp"].asDouble()),
|
|
364
|
+
.rnInstance = rnInstance};
|
|
365
|
+
panGestureApi->setGestureEventTarget(
|
|
366
|
+
panPanGesture, GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE | GESTURE_EVENT_ACTION_END,
|
|
367
|
+
panActionCallBack, onPanActionCallBack);
|
|
368
|
+
if (panGestureApi && componentInstance)
|
|
369
|
+
{
|
|
370
|
+
panGestureApi->addGestureToNode(componentInstance->getLocalRootArkUINode().getArkUINodeHandle(),
|
|
371
|
+
panPanGesture, PARALLEL, NORMAL_GESTURE_MASK);
|
|
372
|
+
ReactBindingxArkTSMessageHandler::getInstance()->isInterceptPan = true;
|
|
373
|
+
}
|
|
374
|
+
else if (!componentInstance)
|
|
375
|
+
{
|
|
376
|
+
DLOG(INFO) << "ReactBindingXPackage componentInstance is null";
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
ReactBindingxArkTSMessageHandler::getInstance()->isInterceptPan = false;
|
|
380
|
+
}
|
|
381
|
+
else if (eventType == "scroll")
|
|
382
|
+
{
|
|
383
|
+
auto maybeTag = (ctx.messagePayload["options"])["anchor"];
|
|
384
|
+
DLOG(INFO) << "ReactBindingXPackage::scroll maybeTag: " << maybeTag.asDouble();
|
|
385
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
|
386
|
+
auto componentInstance = rnInstanceCAPI->findComponentInstanceByTag(maybeTag.asDouble());
|
|
387
|
+
auto anyGestureApi =
|
|
388
|
+
OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_GESTURE, "ArkUI_NativeGestureAPI_1");
|
|
389
|
+
scrollGestureApi = reinterpret_cast<ArkUI_NativeGestureAPI_1 *>(anyGestureApi);
|
|
390
|
+
scrollPanGesture = scrollGestureApi->createPanGesture(1, GESTURE_DIRECTION_VERTICAL, 1);
|
|
391
|
+
folly::dynamic elementViewTag;
|
|
392
|
+
folly::dynamic elementTextTag;
|
|
393
|
+
vector<std::string> propertyAtr;
|
|
394
|
+
for (int i = 0; i < ((ctx.messagePayload["options"])["props"]).size(); i++)
|
|
395
|
+
{
|
|
396
|
+
auto element = ((ctx.messagePayload["options"])["props"])[i]["element"];
|
|
397
|
+
auto property = ((ctx.messagePayload["options"])["props"])[i]["property"];
|
|
398
|
+
propertyAtr.push_back(property.asString());
|
|
399
|
+
if (property == "color")
|
|
400
|
+
{
|
|
401
|
+
elementTextTag = element;
|
|
402
|
+
}
|
|
403
|
+
else
|
|
404
|
+
{
|
|
405
|
+
elementViewTag = element;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (elementViewTag == nullptr)
|
|
409
|
+
return;
|
|
410
|
+
auto elementComponentInstance = rnInstanceCAPI->findComponentInstanceByTag(elementViewTag.asDouble());
|
|
411
|
+
ComponentInstance::Shared elementTextComponentInstance;
|
|
412
|
+
if (elementTextTag != nullptr)
|
|
413
|
+
{
|
|
414
|
+
elementTextComponentInstance =
|
|
415
|
+
rnInstanceCAPI->findComponentInstanceByTag(elementTextTag.asDouble());
|
|
416
|
+
}
|
|
417
|
+
PanActionCallBack *panActionCallBack = new PanActionCallBack{
|
|
418
|
+
.componentInstance = componentInstance,
|
|
419
|
+
.elementViewComponentInstance = elementComponentInstance,
|
|
420
|
+
.elementTextComponentInstance = elementTextComponentInstance,
|
|
421
|
+
.tag = maybeTag.asDouble(),
|
|
422
|
+
.propertyAtr = propertyAtr,
|
|
423
|
+
.backgroundcolor = (ctx.messagePayload["background_color"] != nullptr)
|
|
424
|
+
? ctx.messagePayload["background_color"].asString()
|
|
425
|
+
: nullptr,
|
|
426
|
+
.backgroundcolorEval = (ctx.messagePayload["background_color_eval"] != nullptr)
|
|
427
|
+
? ctx.messagePayload["background_color_eval"].asString()
|
|
428
|
+
: nullptr,
|
|
429
|
+
.color =
|
|
430
|
+
(ctx.messagePayload["color"] != nullptr) ? ctx.messagePayload["color"].asString() : nullptr,
|
|
431
|
+
};
|
|
432
|
+
auto onPanActionCallBack = [](ArkUI_GestureEvent *event, void *extraParam)
|
|
433
|
+
{
|
|
434
|
+
PanActionCallBack *panActionCallBack = (PanActionCallBack *)extraParam;
|
|
435
|
+
ReactBindingxArkTSMessageHandler::getInstance()->m_panActionCallBack = panActionCallBack;
|
|
436
|
+
ReactBindingxArkTSMessageHandler::getInstance()->handleScroll();
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
scrollGestureApi->setGestureEventTarget(scrollPanGesture,
|
|
440
|
+
GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE |
|
|
441
|
+
GESTURE_EVENT_ACTION_END,
|
|
442
|
+
panActionCallBack, onPanActionCallBack);
|
|
443
|
+
scrollGestureApi->addGestureToNode(
|
|
444
|
+
componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), scrollPanGesture,
|
|
445
|
+
PARALLEL, NORMAL_GESTURE_MASK);
|
|
446
|
+
}
|
|
447
|
+
else if (eventType == "timing")
|
|
448
|
+
{
|
|
449
|
+
auto maybeTag = ((ctx.messagePayload["options"])["props"])[0]["element"];
|
|
450
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
|
451
|
+
auto componentInstance = rnInstanceCAPI->findComponentInstanceByTag(maybeTag.asDouble());
|
|
452
|
+
auto x = (ctx.messagePayload["data"])["x"].asDouble();
|
|
453
|
+
auto y = (ctx.messagePayload["data"])["y"].asDouble();
|
|
454
|
+
DLOG(INFO) << "ReactBindingXPackage::timing x:" << x << " y:" << y;
|
|
455
|
+
vector<std::string> propertyAtr;
|
|
456
|
+
for (int i = 0; i < ((ctx.messagePayload["options"])["props"]).size(); i++)
|
|
457
|
+
{
|
|
458
|
+
auto property = ((ctx.messagePayload["options"])["props"])[i]["property"];
|
|
459
|
+
propertyAtr.push_back(property.asString());
|
|
460
|
+
}
|
|
461
|
+
vector<std::string> translateMatchPropertys;
|
|
462
|
+
translateMatchPropertys.push_back("transform.translate");
|
|
463
|
+
translateMatchPropertys.push_back("transform.translateX");
|
|
464
|
+
translateMatchPropertys.push_back("transform.translateY");
|
|
465
|
+
vector<std::string> findTranslateAtr = findProperty(translateMatchPropertys, propertyAtr);
|
|
466
|
+
if (findTranslateAtr.size() > 0)
|
|
467
|
+
{
|
|
468
|
+
std::array<ArkUI_NumberValue, 3> translateValue = {
|
|
469
|
+
ArkUI_NumberValue{.f32 = static_cast<float>(x)}, {.f32 = static_cast<float>(y)}, {.f32 = 0}};
|
|
470
|
+
ArkUI_AttributeItem translateItem = {translateValue.data(), translateValue.size()};
|
|
471
|
+
NativeNodeApi::getInstance()->setAttribute(
|
|
472
|
+
componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), NODE_TRANSLATE,
|
|
473
|
+
&translateItem);
|
|
474
|
+
}
|
|
475
|
+
vector<std::string> opacityMatchPropertys;
|
|
476
|
+
opacityMatchPropertys.push_back("opacity");
|
|
477
|
+
vector<std::string> findOpacityAtr = findProperty(translateMatchPropertys, propertyAtr);
|
|
478
|
+
if (findOpacityAtr.size() > 0)
|
|
479
|
+
{
|
|
480
|
+
ArkUI_NumberValue opacityValue[] = {
|
|
481
|
+
{.f32 = static_cast<float>(ctx.messagePayload["opacity"].asDouble())}};
|
|
482
|
+
ArkUI_AttributeItem opacityItem = {opacityValue, sizeof(opacityValue) / sizeof(ArkUI_NumberValue)};
|
|
483
|
+
NativeNodeApi::getInstance()->setAttribute(
|
|
484
|
+
componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), NODE_OPACITY,
|
|
485
|
+
&opacityItem);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
else if (ctx.messageName == "unbind")
|
|
490
|
+
{
|
|
491
|
+
|
|
492
|
+
auto eventType = (ctx.messagePayload["options"])["eventType"];
|
|
493
|
+
if (eventType == "pan")
|
|
494
|
+
{
|
|
495
|
+
auto maybeTag = (ctx.messagePayload["options"])["token"];
|
|
496
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
|
497
|
+
auto componentInstance = rnInstanceCAPI->findComponentInstanceByTag(maybeTag.asDouble());
|
|
498
|
+
if (panGestureApi && componentInstance)
|
|
499
|
+
{
|
|
500
|
+
panGestureApi->removeGestureFromNode(
|
|
501
|
+
componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), panPanGesture);
|
|
502
|
+
}
|
|
503
|
+
ReactBindingxArkTSMessageHandler::getInstance()->isInterceptPan = false;
|
|
504
|
+
}
|
|
505
|
+
else if (eventType == "scroll")
|
|
506
|
+
{
|
|
507
|
+
DLOG(INFO) << "ReactBindingXPackage::scroll unbind";
|
|
508
|
+
auto maybeTag = (ctx.messagePayload["options"])["token"];
|
|
509
|
+
DLOG(INFO) << "ReactBindingXPackage::event scroll unbind " << maybeTag.asDouble();
|
|
510
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
|
511
|
+
auto componentInstance = rnInstanceCAPI->findComponentInstanceByTag(maybeTag.asDouble());
|
|
512
|
+
if (scrollGestureApi && componentInstance)
|
|
513
|
+
{
|
|
514
|
+
scrollGestureApi->removeGestureFromNode(
|
|
515
|
+
componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), scrollPanGesture);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
else if (ctx.messageName == "eval")
|
|
520
|
+
{
|
|
521
|
+
|
|
522
|
+
auto msg = ctx.messagePayload["data"];
|
|
523
|
+
ExpressHandleEval::getInstance()->init_mapping(ExpressHandleEval::getInstance()->op_mapping);
|
|
524
|
+
double result = ExpressHandleEval::getInstance()->eval(msg.asString());
|
|
525
|
+
std::ostringstream sstream;
|
|
526
|
+
sstream << result;
|
|
527
|
+
std::string eventType = ctx.messagePayload["eventType"].asString();
|
|
528
|
+
if (eventType == "scroll")
|
|
529
|
+
{
|
|
530
|
+
scrollEvalValue = result;
|
|
531
|
+
}
|
|
532
|
+
if (eventType == "timing")
|
|
533
|
+
{
|
|
534
|
+
rnInstance->postMessageToArkTS("eval", result);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
else if (ctx.messageName == "getComputedStyle")
|
|
538
|
+
{
|
|
539
|
+
auto maybeTag = (ctx.messagePayload["element"]).asDouble();
|
|
540
|
+
auto rnInstanceCAPI = std::dynamic_pointer_cast<RNInstanceCAPI>(rnInstance);
|
|
541
|
+
auto componentInstance = rnInstanceCAPI->findComponentInstanceByTag(maybeTag);
|
|
542
|
+
float translate = NativeNodeApi::getInstance()->getAttribute(componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), NODE_TRANSLATE)->value[0].f32;
|
|
543
|
+
float scale = NativeNodeApi::getInstance()->getAttribute(componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), NODE_SCALE)->value[0].f32;
|
|
544
|
+
float roate = NativeNodeApi::getInstance()->getAttribute(componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), NODE_ROTATE)->value[3].f32;
|
|
545
|
+
float opacity = NativeNodeApi::getInstance()->getAttribute(componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), NODE_OPACITY)->value[0].f32;
|
|
546
|
+
float backgroundColor = NativeNodeApi::getInstance()->getAttribute(componentInstance->getLocalRootArkUINode().getArkUINodeHandle(), NODE_BACKGROUND_COLOR)->value[0].u32;
|
|
547
|
+
std::string computedStyle = "{translate:" + to_string(translate) + ",scale:" + to_string(scale) +
|
|
548
|
+
",roate:" + to_string(roate) + ",opacity:" + to_string(opacity) +
|
|
549
|
+
",background-color:" + to_string(backgroundColor) + "}";
|
|
550
|
+
DLOG(INFO) << "ReactBindingXPackage::getComputedStyle post:" << computedStyle;
|
|
551
|
+
rnInstance->postMessageToArkTS("style", computedStyle);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
ReactBindingxArkTSMessageHandler *ReactBindingxArkTSMessageHandler::getInstance()
|
|
556
|
+
{
|
|
557
|
+
if (!m_reactBindingxArkTSMessageHandler)
|
|
558
|
+
{
|
|
559
|
+
m_reactBindingxArkTSMessageHandler = new ReactBindingxArkTSMessageHandler();
|
|
560
|
+
}
|
|
561
|
+
return m_reactBindingxArkTSMessageHandler;
|
|
562
|
+
}
|
|
563
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
#ifndef HARMONY_REACTBINDINGXARKTSMESSAGEHANDLER_H
|
|
26
|
+
#define HARMONY_REACTBINDINGXARKTSMESSAGEHANDLER_H
|
|
27
|
+
#include <arkui/native_gesture.h>
|
|
28
|
+
#include <map>
|
|
29
|
+
#include <vector>
|
|
30
|
+
#include "RNOH/Package.h"
|
|
31
|
+
#include "RNOH/arkui/NativeNodeApi.h"
|
|
32
|
+
#include "RNOHCorePackage/ComponentInstances/ScrollViewComponentInstance.h"
|
|
33
|
+
#include "RNOHCorePackage/ComponentInstances/ViewComponentInstance.h"
|
|
34
|
+
#include "ExpressHandleEval.h"
|
|
35
|
+
#include "RNOH/RNInstanceCAPI.h"
|
|
36
|
+
|
|
37
|
+
namespace rnoh {
|
|
38
|
+
|
|
39
|
+
class ReactBindingxArkTSMessageHandler : public rnoh::ArkTSMessageHandler {
|
|
40
|
+
public:
|
|
41
|
+
ArkUI_NativeGestureAPI_1 *scrollGestureApi;
|
|
42
|
+
ArkUI_NativeGestureAPI_1 *panGestureApi;
|
|
43
|
+
ArkUI_GestureRecognizer *scrollPanGesture;
|
|
44
|
+
ArkUI_GestureRecognizer *panPanGesture;
|
|
45
|
+
std::thread *scrollThread;
|
|
46
|
+
struct PanActionCallBack {
|
|
47
|
+
rnoh::ComponentInstance::Shared componentInstance;
|
|
48
|
+
rnoh::ComponentInstance::Shared elementViewComponentInstance;
|
|
49
|
+
rnoh::ComponentInstance::Shared elementTextComponentInstance;
|
|
50
|
+
float positionX;
|
|
51
|
+
float positionY;
|
|
52
|
+
float offsetX;
|
|
53
|
+
float offsetY;
|
|
54
|
+
float angle;
|
|
55
|
+
bool scrollStatus;
|
|
56
|
+
float scrollY;
|
|
57
|
+
double tag;
|
|
58
|
+
bool startThread;
|
|
59
|
+
std::thread *scrollThread;
|
|
60
|
+
std::string backgroundcolor;
|
|
61
|
+
std::string color;
|
|
62
|
+
std::string backgroundcolorEval;
|
|
63
|
+
std::vector<std::string> propertyAtr;
|
|
64
|
+
float px2vp;
|
|
65
|
+
std::weak_ptr<RNInstance> rnInstance;
|
|
66
|
+
};
|
|
67
|
+
PanActionCallBack *m_panActionCallBack;
|
|
68
|
+
static ReactBindingxArkTSMessageHandler *getInstance();
|
|
69
|
+
float m_scrollY;
|
|
70
|
+
std::map<std::string, std::string> styleMap;
|
|
71
|
+
bool isInterceptPan = true;
|
|
72
|
+
public:
|
|
73
|
+
void handleArkTSMessage(const Context &ctx) override;
|
|
74
|
+
|
|
75
|
+
void handleScroll();
|
|
76
|
+
};
|
|
77
|
+
} // namespace rnoh
|
|
78
|
+
#endif // HARMONY_REACTBINDINGXARKTSMESSAGEHANDLER_H
|