mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Workaround for bridge.isInspectable
Summary: `RCTDevSettings` uses the API `bridge.isInspectable` to understand if the runtime can be debugged. In bridgeless mode, let's use `RuntimeExecutor` to check the same property. Changelog: [Internal] Reviewed By: p-sun Differential Revision: D27095935 fbshipit-source-id: 93785774b175bd7da17269e1590b5d92eba2b0cf
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4079c0454b
commit
dbf5fa2d1a
@@ -30,6 +30,16 @@
|
||||
|
||||
@end
|
||||
|
||||
@protocol RCTDevSettingsInspectable <NSObject>
|
||||
|
||||
/**
|
||||
* Whether current jsi::Runtime is inspectable.
|
||||
* Only set when using as a bridgeless turbo module.
|
||||
*/
|
||||
@property (nonatomic, assign, readwrite) BOOL isInspectable;
|
||||
|
||||
@end
|
||||
|
||||
@interface RCTDevSettings : RCTEventEmitter
|
||||
|
||||
- (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource;
|
||||
|
||||
@@ -114,7 +114,12 @@ void RCTDevSettingsSetEnabled(BOOL enabled)
|
||||
|
||||
@end
|
||||
|
||||
@interface RCTDevSettings () <RCTBridgeModule, RCTInvalidating, NativeDevSettingsSpec, RCTBundleHolderModule> {
|
||||
@interface RCTDevSettings () <
|
||||
RCTBridgeModule,
|
||||
RCTInvalidating,
|
||||
NativeDevSettingsSpec,
|
||||
RCTBundleHolderModule,
|
||||
RCTDevSettingsInspectable> {
|
||||
BOOL _isJSLoaded;
|
||||
#if ENABLE_PACKAGER_CONNECTION
|
||||
RCTHandlerToken _reloadToken;
|
||||
@@ -129,6 +134,7 @@ void RCTDevSettingsSetEnabled(BOOL enabled)
|
||||
@implementation RCTDevSettings
|
||||
|
||||
@synthesize bundleURL = _bundleURL;
|
||||
@synthesize isInspectable = _isInspectable;
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
@@ -242,7 +248,11 @@ RCT_EXPORT_MODULE()
|
||||
- (BOOL)isDeviceDebuggingAvailable
|
||||
{
|
||||
#if RCT_ENABLE_INSPECTOR
|
||||
return self.bridge.isInspectable;
|
||||
if (self.bridge) {
|
||||
return self.bridge.isInspectable;
|
||||
} else {
|
||||
return self.isInspectable;
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif // RCT_ENABLE_INSPECTOR
|
||||
|
||||
Reference in New Issue
Block a user