Skip to main content

OH_ArkUI_NativeModule_AdoptChild

Function OH_ArkUI_NativeModule_AdoptChild 

Source
pub unsafe extern "C" fn OH_ArkUI_NativeModule_AdoptChild(
    node: ArkUI_NodeHandle,
    child: ArkUI_NodeHandle,
) -> i32
Available on crate features api-12 and api-22 only.
Expand description

The current node adopts the target child node. The node being adopted must not have an existing parent node. This operation does not actually append it as a child, but only allows it to receive life-cycle callbacks as if it were a child.

§Arguments

  • node - ArkUI_NodeHandle pointer, the parent node that will adopt the child node.

  • child - ArkUI_NodeHandle pointer, the target node being adopted.

§Returns

  • Error code. [ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. [ARKUI_ERROR_CODE_CAPI_INIT_ERROR] if the CAPI init error. [ARKUI_ERROR_CODE_NODE_HAS_PARENT] The child already has a parent node. [ARKUI_ERROR_CODE_NODE_CAN_NOT_BE_ADOPTED] The child can not be adopted. [ARKUI_ERROR_CODE_NODE_CAN_NOT_ADOPT_TO] The node can not adopt children.

Available since API-level: 22