diff --git a/arkui/ace_engine/native/BUILD.gn b/arkui/ace_engine/native/BUILD.gn index df21fe5b3a27ca1ab64d27aa2778170b664f3246..2dc4d659ab97da9c08ecc5c7b50bfb022b034961 100644 --- a/arkui/ace_engine/native/BUILD.gn +++ b/arkui/ace_engine/native/BUILD.gn @@ -29,6 +29,7 @@ if (!is_arkui_x) { "native_event.h", "native_interface.h", "native_node.h", + "native_node_napi.h", "native_type.h", "ui_input_event.h", ] diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index af9796452b8e492be2988f84f81ecebfa0aab2dc..bb3303979583a242d9b9a31781147b55fce20aac 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -150,5 +150,9 @@ { "first_introduced": "12", "name": "OH_ArkUI_AxisEvent_GetPinchAxisScaleValue" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_GetNodeHandleFromNapiValue" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_node_napi.h b/arkui/ace_engine/native/native_node_napi.h new file mode 100644 index 0000000000000000000000000000000000000000..cc219bd5a3406dd7122c2285bc088c6437f2ccc0 --- /dev/null +++ b/arkui/ace_engine/native/native_node_napi.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup ArkUI_NativeModule + * @{ + * + * @brief Provides UI capabilities of ArkUI on the native side, such as UI component creation and destruction, + * tree node operations, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_node_napi.h + * + * @brief Declares APIs for converting FrameNode objects on the ArkTS side to ArkUI_NodeHandle objects on + * the native side. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_NODE_NAPI_H +#define ARKUI_NATIVE_NODE_NAPI_H + +#include "napi/native_api.h" +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief Obtains a FrameNode object on the ArkTS side and maps it to an ArkUI_NodeHandle object on the + * native side. + * + * @param env Indicates the NAPI environment pointer. + * @param frameNode Indicates the FrameNode object created on the ArkTS side. + * @param handle Indicates the pointer to the ArkUI_NodeHandle object. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_GetNodeHandleFromNapiValue(napi_env env, napi_value frameNode, ArkUI_NodeHandle* handle); + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_NODE_NAPI_H +/** @} */