From 8ba73a79f28ab98fa1904c51beddff056d2c04f9 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Tue, 4 May 2021 18:31:35 -0700 Subject: [PATCH] Attach RCTBundleManager to TurboModules (Bridge mode) Summary: See title. Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D28160096 fbshipit-source-id: c14e5a5bc9f226f1e2559b3a256edcf5379d3c2e --- React/CxxBridge/RCTCxxBridge.mm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 589c037f461..2e4bf048130 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -257,12 +257,23 @@ struct RCTInstanceCallback : public InstanceCallback { * Attach the RCTViewRegistry to this TurboModule, which allows this TurboModule * To query a React component's UIView, given its reactTag. * - * Usage: In the NativeModule @implementation, include: + * Usage: In the TurboModule @implementation, include: * `@synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED` */ if ([bridgeModule respondsToSelector:@selector(setViewRegistry_DEPRECATED:)]) { bridgeModule.viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED; } + + /** + * Attach the RCTBundleManager to this TurboModule, which allows this TurboModule to + * read from/write to the app's bundle URL. + * + * Usage: In the TurboModule @implementation, include: + * `@synthesize bundleManager = _bundleManager` + */ + if ([bridgeModule respondsToSelector:@selector(setBundleManager:)]) { + bridgeModule.bundleManager = _bundleManager; + } } - (std::shared_ptr)jsMessageThread