From f1145d431bb23ad21394722878ef9cc0becd2810 Mon Sep 17 00:00:00 2001 From: Kudo Chien Date: Mon, 6 May 2024 20:40:17 +0800 Subject: [PATCH] Fix HermesExecutorFactory build error --- .../ReactCommon/hermes/executor/HermesExecutorFactory.cpp | 5 ++++- .../ReactCommon/hermes/executor/HermesExecutorFactory.h | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp index 8ee40df6785a6e..e7c8886fa07322 100644 --- a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +++ b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -258,7 +259,9 @@ HermesExecutor::HermesExecutor( jsinspector_modern::RuntimeTargetDelegate& HermesExecutor::getRuntimeTargetDelegate() { if (!targetDelegate_) { - targetDelegate_.emplace(hermesRuntime_); + targetDelegate_ = + std::make_unique( + hermesRuntime_); } return *targetDelegate_; } diff --git a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.h b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.h index ea370876d7af42..89fce4d04c469c 100644 --- a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.h +++ b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.h @@ -8,7 +8,6 @@ #pragma once #include -#include #include #include @@ -62,8 +61,7 @@ class HermesExecutor : public JSIExecutor { JSIScopedTimeoutInvoker timeoutInvoker_; std::shared_ptr runtime_; std::shared_ptr hermesRuntime_; - std::optional - targetDelegate_; + std::unique_ptr targetDelegate_; }; } // namespace facebook::react