From 3575e21f7308c370f4a045dad9dc1913192e0822 Mon Sep 17 00:00:00 2001 From: Phillip Pan Date: Thu, 21 Nov 2024 23:02:15 -0800 Subject: [PATCH] fix extraModulesForBridge: in interop Summary: Changelog: [Internal] the delegate of TMM is RCTInstance, but RCTInstance doesn't forward all of the APIs and we aren't protected by the compiler because of the optional in TMMDelegate i found that this backwards compat API did not actually get set up correctly and was never working in the first place... this is why we should avoid optional long term, TMMDelegate needs to be pushed down to the infra layer and not exist in product, cc blakef Reviewed By: javache Differential Revision: D66148789 fbshipit-source-id: 925a6d4ebb6ba6bfb0b1aec6710695e7551ba475 --- .../runtime/platform/ios/ReactCommon/RCTInstance.mm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm index 53f4ec3c32b..8dd279da7d6 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm @@ -144,8 +144,8 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags) { std::lock_guard lock(_invalidationMutex); _valid = false; - if (self->_reactInstance) { - self->_reactInstance->unregisterFromInspector(); + if (_reactInstance) { + _reactInstance->unregisterFromInspector(); } [_surfacePresenter suspend]; [_jsThreadManager dispatchToJSThread:^{ @@ -210,6 +210,15 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags) return nullptr; } +- (NSArray> *)extraModulesForBridge:(RCTBridge *)bridge +{ + if ([_appTMMDelegate respondsToSelector:@selector(extraModulesForBridge:)]) { + return [_appTMMDelegate extraModulesForBridge:nil]; + } + + return @[]; +} + #pragma mark - Private - (void)_start