diff --git a/frameworks/core/interfaces/native/implementation/common_method_modifier.cpp b/frameworks/core/interfaces/native/implementation/common_method_modifier.cpp index 4e15a4e9317667878c6bd271d4e0a5bf7aa53a9b..6a6673b19d0015ac2290febefc8b1ca9b93782a9 100644 --- a/frameworks/core/interfaces/native/implementation/common_method_modifier.cpp +++ b/frameworks/core/interfaces/native/implementation/common_method_modifier.cpp @@ -5609,15 +5609,17 @@ void BindContextMenuBase(Ark_NativePointer node, } auto type = Converter::OptConvertPtr(responseType).value_or(ResponseType::LONG_PRESS); auto contentBuilder = [callback = CallbackHelper(*optValue), node, frameNode, type]( - MenuParam menuParam, std::function&& previewBuildFunc) { - auto builder = [node, frameNode, callback]() { - auto uiNode = callback.BuildSync(node); - PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode)); - ViewStackProcessor::GetInstance()->Push(uiNode); - }; - ViewAbstractModelStatic::BindContextMenuStatic( - AceType::Claim(frameNode), type, std::move(builder), menuParam, std::move(previewBuildFunc)); - ViewAbstractModelStatic::BindDragWithContextMenuParamsStatic(frameNode, menuParam); + MenuParam menuParam, std::function&& previewBuildFunc) { + callback.BuildAsync([frameNode, menuParam, type, previewBuildFunc](const RefPtr& uiNode) { + std::function previewFuncCopy = previewBuildFunc; + auto builder = [frameNode, uiNode]() { + PipelineContext::SetCallBackNode(AceType::WeakClaim(frameNode)); + ViewStackProcessor::GetInstance()->Push(uiNode); + }; + ViewAbstractModelStatic::BindContextMenuStatic( + AceType::Claim(frameNode), type, std::move(builder), menuParam, std::move(previewFuncCopy)); + ViewAbstractModelStatic::BindDragWithContextMenuParamsStatic(frameNode, menuParam); + }, node); }; menuParam.previewMode = MenuPreviewMode::NONE; auto menuOption = Converter::GetOptPtr(options);