From aec6666bfabf93cde70fa869b3eea68590998dee Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Thu, 12 Sep 2024 07:05:39 -0700 Subject: [PATCH] Re-add `RCTHermesInstance` constructor for compatibility (#46453) Summary: https://github.com/facebook/react-native/pull/46314 introduced a breaking change, making it hard to maintain backwards compatibility elsewhere. This change re-introduces the constructor that takes two arguments. ## Changelog: [IOS] [FIXED] - Unbreak `RCTHermesInstance` constructor breaking change Pull Request resolved: https://github.com/facebook/react-native/pull/46453 Test Plan: n/a Reviewed By: javache Differential Revision: D62574496 Pulled By: cortinico fbshipit-source-id: dcd15bf9694f4b14e37d61d7209193b3e448cd6b --- .../runtime/platform/ios/ReactCommon/RCTHermesInstance.h | 3 +++ .../runtime/platform/ios/ReactCommon/RCTHermesInstance.mm | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h index ea2565b3543..900d87b85bb 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h @@ -22,6 +22,9 @@ using CrashManagerProvider = class RCTHermesInstance : public JSRuntimeFactory { public: RCTHermesInstance(); + RCTHermesInstance( + std::shared_ptr reactNativeConfig, + CrashManagerProvider crashManagerProvider); RCTHermesInstance( std::shared_ptr reactNativeConfig, CrashManagerProvider crashManagerProvider, diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.mm b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.mm index bd3ea5c7a97..c33500093ee 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.mm +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.mm @@ -11,6 +11,13 @@ namespace facebook::react { RCTHermesInstance::RCTHermesInstance() : RCTHermesInstance(nullptr, nullptr, false) {} +RCTHermesInstance::RCTHermesInstance( + std::shared_ptr reactNativeConfig, + CrashManagerProvider crashManagerProvider) + : RCTHermesInstance(reactNativeConfig, std::move(crashManagerProvider), false) +{ +} + RCTHermesInstance::RCTHermesInstance( std::shared_ptr reactNativeConfig, CrashManagerProvider crashManagerProvider,