@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
package/LICENSE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2018 Alibaba Group
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Name": "react-native-bindingx",
|
|
4
|
+
"License": "Apache License",
|
|
5
|
+
"License File": "LICENSE.md",
|
|
6
|
+
"Version Number": "1.0.3",
|
|
7
|
+
"Owner" : "xiafeng@huawei.com",
|
|
8
|
+
"Upstream URL": "https://github.com/alibaba/bindingx",
|
|
9
|
+
"Description": "Bind actions to effects"
|
|
10
|
+
}
|
|
11
|
+
]
|
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @react-native-oh-tpl/react-native-bindingx
|
|
2
|
+
|
|
3
|
+
This project is based on [alibaba/bindingx](https://github.com/alibaba/bindingx)
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
[中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-bindingx.md)
|
|
8
|
+
|
|
9
|
+
[English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-bindingx.md)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## License
|
|
13
|
+
|
|
14
|
+
This library is licensed under [The MIT License (MIT)](https://github.com/react-native-oh-library/react-native-bindingx/blob/sig/LICENSE.md).
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
export * from "./ts"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
license: '',
|
|
3
|
+
devDependencies: {},
|
|
4
|
+
author: '',
|
|
5
|
+
name: '@react-native-ohos/react-native-bindingx',
|
|
6
|
+
description: '',
|
|
7
|
+
main: 'index.ets',
|
|
8
|
+
version: '1.0.4-rc.1',
|
|
9
|
+
dependencies: {
|
|
10
|
+
"@rnoh/react-native-openharmony": 'file:../react_native_openharmony',
|
|
11
|
+
},
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.13)
|
|
2
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
3
|
+
|
|
4
|
+
file(GLOB rnoh_bindingx_SRC CONFIGURE_DEPENDS *.cpp)
|
|
5
|
+
add_library(rnoh_bindingx SHARED ${rnoh_bindingx_SRC})
|
|
6
|
+
target_include_directories(rnoh_bindingx PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
7
|
+
target_link_libraries(rnoh_bindingx PUBLIC rnoh)
|
|
8
|
+
|
|
@@ -0,0 +1,176 @@
|
|
|
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
|
+
#include "ExpressHandleEval.h"
|
|
26
|
+
|
|
27
|
+
namespace rnoh {
|
|
28
|
+
|
|
29
|
+
string ops = "+-*/()";
|
|
30
|
+
bool ValueError = false;
|
|
31
|
+
bool ExpressionError = false;
|
|
32
|
+
ExpressHandleEval *m_ExpressHandleEval;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
double toDouble(string str) {
|
|
36
|
+
double target;
|
|
37
|
+
stringstream ss;
|
|
38
|
+
ss << str;
|
|
39
|
+
ss >> target;
|
|
40
|
+
return target;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
void ExpressHandleEval::init_mapping(map<string, int> &mapping) {
|
|
45
|
+
mapping["+"] = 0;
|
|
46
|
+
mapping["-"] = 0;
|
|
47
|
+
mapping["*"] = 1;
|
|
48
|
+
mapping["/"] = 1;
|
|
49
|
+
mapping["("] = 2;
|
|
50
|
+
mapping[")"] = 2;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
vector<string> toPostfix(string formula) {
|
|
55
|
+
vector<string> result;
|
|
56
|
+
vector<string> op_stack;
|
|
57
|
+
string cur_num, cur_op;
|
|
58
|
+
|
|
59
|
+
for (int i = 0; i < formula.size(); ++i) {
|
|
60
|
+
if (ops.find(formula[i]) == ops.npos)
|
|
61
|
+
cur_num += formula[i];
|
|
62
|
+
|
|
63
|
+
else
|
|
64
|
+
{
|
|
65
|
+
if (!cur_num.empty()) {
|
|
66
|
+
result.push_back(cur_num);
|
|
67
|
+
cur_num.clear();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
cur_op = formula[i];
|
|
71
|
+
|
|
72
|
+
if (op_stack.empty())
|
|
73
|
+
op_stack.push_back(cur_op);
|
|
74
|
+
else if (cur_op == "(")
|
|
75
|
+
op_stack.push_back(cur_op);
|
|
76
|
+
|
|
77
|
+
else if (cur_op == ")")
|
|
78
|
+
{
|
|
79
|
+
while (op_stack.back() != "(") {
|
|
80
|
+
result.push_back(op_stack.back());
|
|
81
|
+
op_stack.pop_back();
|
|
82
|
+
|
|
83
|
+
if (op_stack.empty())
|
|
84
|
+
{
|
|
85
|
+
ExpressionError = true;
|
|
86
|
+
result.push_back("0");
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
op_stack.pop_back();
|
|
91
|
+
} else if (op_stack.back() == "(")
|
|
92
|
+
op_stack.push_back(cur_op);
|
|
93
|
+
else if (
|
|
94
|
+
ExpressHandleEval::getInstance()->op_mapping[cur_op] >
|
|
95
|
+
ExpressHandleEval::getInstance()->op_mapping
|
|
96
|
+
[op_stack
|
|
97
|
+
.back()])
|
|
98
|
+
op_stack.push_back(cur_op);
|
|
99
|
+
else
|
|
100
|
+
{
|
|
101
|
+
while ((op_stack.back() != "(") && (ExpressHandleEval::getInstance()->op_mapping[op_stack.back()] >=
|
|
102
|
+
ExpressHandleEval::getInstance()->op_mapping[cur_op])) {
|
|
103
|
+
result.push_back(op_stack.back());
|
|
104
|
+
op_stack.pop_back();
|
|
105
|
+
if (op_stack.empty())
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
op_stack.push_back(cur_op);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
result.push_back(cur_num);
|
|
114
|
+
while (!op_stack.empty()) {
|
|
115
|
+
result.push_back(op_stack.back());
|
|
116
|
+
op_stack.pop_back();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
double calculatePostfix(vector<string> &postfix) {
|
|
122
|
+
vector<double> result;
|
|
123
|
+
for (int i = 0; i < postfix.size(); ++i) {
|
|
124
|
+
if (ops.find(postfix[i]) == ops.npos)
|
|
125
|
+
result.push_back(toDouble(postfix[i]));
|
|
126
|
+
else
|
|
127
|
+
{
|
|
128
|
+
if (result.size() < 2) {
|
|
129
|
+
ExpressionError = true;
|
|
130
|
+
return 0.0;
|
|
131
|
+
}
|
|
132
|
+
double num1 = result.back();
|
|
133
|
+
result.pop_back();
|
|
134
|
+
double num2 = result.back();
|
|
135
|
+
result.pop_back();
|
|
136
|
+
double op_res;
|
|
137
|
+
if (postfix[i] == "+")
|
|
138
|
+
op_res = num2 + num1;
|
|
139
|
+
else if (postfix[i] == "-")
|
|
140
|
+
op_res = num2 - num1;
|
|
141
|
+
else if (postfix[i] == "*")
|
|
142
|
+
op_res = num2 * num1;
|
|
143
|
+
else if (postfix[i] == "/") {
|
|
144
|
+
if (num1 == 0) {
|
|
145
|
+
ValueError = true;
|
|
146
|
+
return 0.0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
op_res = num2 / num1;
|
|
150
|
+
}
|
|
151
|
+
result.push_back(op_res);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (result.size() == 1)
|
|
155
|
+
return result.back();
|
|
156
|
+
else
|
|
157
|
+
{
|
|
158
|
+
ExpressionError = true;
|
|
159
|
+
return 0.0;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
double ExpressHandleEval::eval(const string &infix) {
|
|
164
|
+
vector<string> postfix = toPostfix(infix);
|
|
165
|
+
return calculatePostfix(postfix);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
ExpressHandleEval *ExpressHandleEval::getInstance() {
|
|
169
|
+
if (!m_ExpressHandleEval) {
|
|
170
|
+
m_ExpressHandleEval = new ExpressHandleEval();
|
|
171
|
+
}
|
|
172
|
+
return m_ExpressHandleEval;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,51 @@
|
|
|
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_EXPRESSHANDLEEVAL_H
|
|
26
|
+
#define HARMONY_EXPRESSHANDLEEVAL_H
|
|
27
|
+
|
|
28
|
+
#include <iostream>
|
|
29
|
+
#include <stdio.h>
|
|
30
|
+
#include <sstream>
|
|
31
|
+
#include <string>
|
|
32
|
+
#include <vector>
|
|
33
|
+
#include <map>
|
|
34
|
+
using namespace std;
|
|
35
|
+
|
|
36
|
+
namespace rnoh {
|
|
37
|
+
class ExpressHandleEval {
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
map<string, int> op_mapping;
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
ExpressHandleEval() {}
|
|
44
|
+
static ExpressHandleEval *getInstance();
|
|
45
|
+
void init_mapping(map<string, int> &mapping);
|
|
46
|
+
double eval(const string &infix);
|
|
47
|
+
};
|
|
48
|
+
} // namespace rnoh
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
#endif // HARMONY_EXPRESSHANDLEEVAL_H
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
#include "ReactBindingXModule.h"
|
|
26
|
+
|
|
27
|
+
// This file was generated.
|
|
28
|
+
|
|
29
|
+
namespace rnoh {
|
|
30
|
+
using namespace facebook;
|
|
31
|
+
|
|
32
|
+
ReactBindingXModule::ReactBindingXModule(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
|
|
33
|
+
methodMap_ = {
|
|
34
|
+
ARK_METHOD_METADATA(bind, 1),
|
|
35
|
+
ARK_METHOD_METADATA(unbind, 1),
|
|
36
|
+
ARK_METHOD_METADATA(unbindAll, 0),
|
|
37
|
+
ARK_METHOD_METADATA(prepare, 1),
|
|
38
|
+
ARK_ASYNC_METHOD_METADATA(getComputedStyle, 1),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
#pragma once
|
|
26
|
+
|
|
27
|
+
// This file was generated.
|
|
28
|
+
|
|
29
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
30
|
+
|
|
31
|
+
namespace rnoh {
|
|
32
|
+
|
|
33
|
+
class JSI_EXPORT ReactBindingXModule : public ArkTSTurboModule {
|
|
34
|
+
public:
|
|
35
|
+
ReactBindingXModule(const ArkTSTurboModule::Context ctx, const std::string name);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
#pragma once
|
|
26
|
+
#include "ReactBindingXPackage.h"
|
|
27
|
+
#include "RNOH/RNInstanceCAPI.h"
|
|
28
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
29
|
+
#include "ReactBindingXModule.h"
|
|
30
|
+
#include "RNOH/arkui/NativeNodeApi.h"
|
|
31
|
+
#include "RNOHCorePackage/ComponentInstances/ViewComponentInstance.h"
|
|
32
|
+
#include "ReactBindingxArkTSMessageHandler.h"
|
|
33
|
+
using namespace rnoh;
|
|
34
|
+
using namespace facebook;
|
|
35
|
+
|
|
36
|
+
class ReactBindingXTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
|
|
37
|
+
public:
|
|
38
|
+
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
|
39
|
+
if (name == "ReactBindingXModule") {
|
|
40
|
+
return std::make_shared<ReactBindingXModule>(ctx, name);
|
|
41
|
+
}
|
|
42
|
+
return nullptr;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
std::unique_ptr<TurboModuleFactoryDelegate> ReactBindingXPackage::createTurboModuleFactoryDelegate() {
|
|
48
|
+
return std::make_unique<ReactBindingXTurboModuleFactoryDelegate>();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
std::vector<ArkTSMessageHandler::Shared> ReactBindingXPackage::createArkTSMessageHandlers() {
|
|
52
|
+
return {std::make_shared<ReactBindingxArkTSMessageHandler>()};
|
|
53
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
#pragma once
|
|
26
|
+
#include "RNOH/Package.h"
|
|
27
|
+
|
|
28
|
+
namespace rnoh {
|
|
29
|
+
class ReactBindingXPackage : public Package {
|
|
30
|
+
public:
|
|
31
|
+
ReactBindingXPackage(Package::Context ctx) : Package(ctx) {}
|
|
32
|
+
|
|
33
|
+
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override;
|
|
34
|
+
|
|
35
|
+
std::vector<ArkTSMessageHandler::Shared> createArkTSMessageHandlers() override;
|
|
36
|
+
};
|
|
37
|
+
} // namespace rnoh
|