!40509 NDK C-API ets node fix

Merge pull request !40509 from firminly/liyi3
This commit is contained in:
openharmony_ci 2024-08-15 14:04:14 +00:00 committed by Gitee
commit caa48d8fd4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 9 additions and 2 deletions

View File

@ -16,6 +16,7 @@
#ifndef ARKUI_NATIVE_DIALOG_H
#define ARKUI_NATIVE_DIALOG_H
#include <stdbool.h>
#include "native_type.h"
#ifdef __cplusplus

View File

@ -853,7 +853,7 @@ typedef enum {
*/
ARKUI_SCROLL_NESTED_MODE_SELF_ONLY = 0,
/** The component scrolls first, and when it hits the boundary, the parent component scrolls.
* When the parent component hits the boundary, its edge effect is displayed. If no edge effect is specified for
* When the parent component hits the boundary, its edge effect is displayed. If no edge effect is specified for
* the parent component, the edge effect of the child component is displayed instead.
*/
ARKUI_SCROLL_NESTED_MODE_SELF_FIRST,

View File

@ -28,6 +28,7 @@ int32_t OH_ArkUI_GetNodeHandleFromNapiValue(napi_env env, napi_value value, ArkU
{
bool hasProperty = false;
auto result = napi_has_named_property(env, value, "nodePtr_", &hasProperty);
auto* impl = OHOS::Ace::NodeModel::GetFullImpl();
if (result == napi_ok && hasProperty) {
napi_value frameNodePtr = nullptr;
auto result = napi_get_named_property(env, value, "nodePtr_", &frameNodePtr);
@ -45,6 +46,9 @@ int32_t OH_ArkUI_GetNodeHandleFromNapiValue(napi_env env, napi_value value, ArkU
auto* uiNodePtr = reinterpret_cast<OHOS::Ace::NG::UINode*>(nativePtr);
uiNodePtr->IncRefCount();
*handle = new ArkUI_Node({ .type = -1, .uiNodeHandle = reinterpret_cast<ArkUINodeHandle>(nativePtr) });
if (impl) {
impl->getExtendedAPI()->setAttachNodePtr((*handle)->uiNodeHandle, reinterpret_cast<void*>(*handle));
}
return OHOS::Ace::ERROR_CODE_NO_ERROR;
}
result = napi_has_named_property(env, value, "builderNode_", &hasProperty);
@ -76,7 +80,6 @@ int32_t OH_ArkUI_GetNodeHandleFromNapiValue(napi_env env, napi_value value, ArkU
}
if (frameNode->GetTag() == "BuilderProxyNode") {
// need to get the really frameNode.
auto* impl = OHOS::Ace::NodeModel::GetFullImpl();
if (!impl) {
return OHOS::Ace::ERROR_CODE_NATIVE_IMPL_LIBRARY_NOT_FOUND;
}
@ -90,6 +93,9 @@ int32_t OH_ArkUI_GetNodeHandleFromNapiValue(napi_env env, napi_value value, ArkU
}
frameNode->IncRefCount();
*handle = new ArkUI_Node({ .type = -1, .uiNodeHandle = reinterpret_cast<ArkUINodeHandle>(frameNode) });
if (impl) {
impl->getExtendedAPI()->setAttachNodePtr((*handle)->uiNodeHandle, reinterpret_cast<void*>(*handle));
}
return OHOS::Ace::ERROR_CODE_NO_ERROR;
}
return OHOS::Ace::ERROR_CODE_PARAM_INVALID;