Skip to content

Commit

Permalink
Bridgeless support for RCTSourceCode
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal]

`RCTSourceCode` uses the bridge to export bundleURL. This adds bridgeless support.

Reviewed By: mdvacca

Differential Revision: D27925767

fbshipit-source-id: 46e93f54abfe8d27ace1241317fa22f24be717fe
  • Loading branch information
Peter Argany authored and facebook-github-bot committed Apr 22, 2021
1 parent ca8a755 commit 2c34946
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions React/CoreModules/RCTSourceCode.mm
Expand Up @@ -10,19 +10,21 @@
#import <FBReactNativeSpec/FBReactNativeSpec.h>

#import <React/RCTBridge.h>
#import <React/RCTBundleHolderModule.h>

#import "CoreModulesPlugins.h"

using namespace facebook::react;

@interface RCTSourceCode () <NativeSourceCodeSpec>
@interface RCTSourceCode () <NativeSourceCodeSpec, RCTBundleHolderModule>
@end

@implementation RCTSourceCode

RCT_EXPORT_MODULE()

@synthesize bridge = _bridge;
@synthesize bundleURL = _bundleURL;

+ (BOOL)requiresMainQueueSetup
{
Expand All @@ -36,8 +38,13 @@ + (BOOL)requiresMainQueueSetup

- (NSDictionary<NSString *, id> *)getConstants
{
if (_bridge) {
return @{
@"scriptURL" : self.bridge.bundleURL.absoluteString ?: @"",
};
}
return @{
@"scriptURL" : self.bridge.bundleURL.absoluteString ?: @"",
@"scriptURL" : _bundleURL.absoluteString ?: @"",
};
}

Expand Down

0 comments on commit 2c34946

Please sign in to comment.