mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove isValid from RCTInvalidating
Summary: We only actually use it on RCTBridge and RCTJavaScriptExecutor, so add it to these interfaces explicitly
This commit is contained in:
@@ -62,6 +62,7 @@ id<RCTJavaScriptExecutor> RCTGetLatestExecutor(void)
|
||||
@implementation RCTBatchedBridge
|
||||
{
|
||||
BOOL _loading;
|
||||
BOOL _valid;
|
||||
__weak id<RCTJavaScriptExecutor> _javaScriptExecutor;
|
||||
NSMutableArray *_moduleDataByID;
|
||||
RCTModuleMap *_modulesByName;
|
||||
@@ -72,8 +73,6 @@ id<RCTJavaScriptExecutor> RCTGetLatestExecutor(void)
|
||||
RCTSparseArray *_scheduledCallbacks;
|
||||
}
|
||||
|
||||
@synthesize valid = _valid;
|
||||
|
||||
- (instancetype)initWithParentBridge:(RCTBridge *)bridge
|
||||
{
|
||||
RCTAssertMainThread();
|
||||
|
||||
@@ -145,6 +145,11 @@ RCT_EXTERN NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass);
|
||||
*/
|
||||
@property (nonatomic, readonly, getter=isLoading) BOOL loading;
|
||||
|
||||
/**
|
||||
* Use this to check if the bridge has been invalidated.
|
||||
*/
|
||||
@property (nonatomic, readonly, getter=isValid) BOOL valid;
|
||||
|
||||
/**
|
||||
* The block passed in the constructor with pre-initialized modules
|
||||
*/
|
||||
|
||||
@@ -244,11 +244,6 @@ RCT_NOT_IMPLEMENTED(-init)
|
||||
return _batchedBridge.loading;
|
||||
}
|
||||
|
||||
- (BOOL)isValid
|
||||
{
|
||||
return _batchedBridge.isValid;
|
||||
}
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
RCTAssertMainThread();
|
||||
@@ -260,7 +255,7 @@ RCT_NOT_IMPLEMENTED(-init)
|
||||
+ (void)logMessage:(NSString *)message level:(NSString *)level
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (!RCTGetLatestExecutor().isValid) {
|
||||
if (![RCTGetLatestExecutor() isValid]) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,8 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// TODO (#5906496): This protocol is only used to add method definitions to
|
||||
// classes. We should decide if it's actually necessary.
|
||||
|
||||
@protocol RCTInvalidating <NSObject>
|
||||
|
||||
@property (nonatomic, assign, readonly, getter = isValid) BOOL valid;
|
||||
|
||||
- (void)invalidate;
|
||||
|
||||
@end
|
||||
|
||||
@@ -29,6 +29,11 @@ typedef void (^RCTJavaScriptCallback)(id json, NSError *error);
|
||||
*/
|
||||
- (void)setUp;
|
||||
|
||||
/**
|
||||
* Whether the executor has been invalidated
|
||||
*/
|
||||
@property (nonatomic, readonly, getter=isValid) BOOL valid;
|
||||
|
||||
/**
|
||||
* Executes given method with arguments on JS thread and calls the given callback
|
||||
* with JSValue and JSContext as a result of the JS module call.
|
||||
|
||||
@@ -292,14 +292,9 @@ RCT_NOT_IMPLEMENTED(-initWithCoder:(NSCoder *)aDecoder)
|
||||
[_bridge.uiManager registerRootView:self];
|
||||
}
|
||||
|
||||
- (BOOL)isValid
|
||||
{
|
||||
return self.userInteractionEnabled;
|
||||
}
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
if (self.isValid) {
|
||||
if (self.userInteractionEnabled) {
|
||||
self.userInteractionEnabled = NO;
|
||||
[(RCTRootView *)self.superview contentViewInvalidated];
|
||||
[_bridge enqueueJSCall:@"ReactNative.unmountComponentAtNodeAndRemoveContainer"
|
||||
|
||||
Reference in New Issue
Block a user