diff --git a/packages/react-native/ReactCommon/callinvoker/ReactCommon/CallInvoker.h b/packages/react-native/ReactCommon/callinvoker/ReactCommon/CallInvoker.h index ee8affb8057..91a8b4ee591 100644 --- a/packages/react-native/ReactCommon/callinvoker/ReactCommon/CallInvoker.h +++ b/packages/react-native/ReactCommon/callinvoker/ReactCommon/CallInvoker.h @@ -38,11 +38,11 @@ class CallInvoker { // Backward compatibility only, prefer the CallFunc methods instead virtual void invokeAsync(std::function&& func) noexcept { - invokeAsync([func](jsi::Runtime&) { func(); }); + invokeAsync([func = std::move(func)](jsi::Runtime&) { func(); }); } virtual void invokeSync(std::function&& func) { - invokeSync([func](jsi::Runtime&) { func(); }); + invokeSync([func = std::move(func)](jsi::Runtime&) { func(); }); } virtual ~CallInvoker() = default;