mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Use new enqueueJSCall method everywhere
Reviewed By: majak Differential Revision: D3605263 fbshipit-source-id: 215f896d675b937593c8b796ed6ec5261ac74dbf
This commit is contained in:
committed by
Facebook Github Bot 8
parent
1ab4b2a792
commit
e762d961cd
@@ -557,7 +557,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)dele
|
||||
NSString *path = [self.bundleURL.path substringFromIndex:1]; // strip initial slash
|
||||
NSString *host = self.bundleURL.host;
|
||||
NSNumber *port = self.bundleURL.port;
|
||||
[self enqueueJSCall:@"HMRClient.enable" args:@[@"ios", path, host, RCTNullIfNil(port)]];
|
||||
[self enqueueJSCall:@"HMRClient"
|
||||
method:@"enable"
|
||||
args:@[@"ios", path, host, RCTNullIfNil(port)]
|
||||
completion:NULL];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -745,8 +748,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
||||
- (void)logMessage:(NSString *)message level:(NSString *)level
|
||||
{
|
||||
if (RCT_DEBUG && [_javaScriptExecutor isValid]) {
|
||||
[self enqueueJSCall:@"RCTLog.logIfNoNativeHook"
|
||||
args:@[level, message]];
|
||||
[self enqueueJSCall:@"RCTLog"
|
||||
method:@"logIfNoNativeHook"
|
||||
args:@[level, message]
|
||||
completion:NULL];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,14 +63,18 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)sendAppEventWithName:(NSString *)name body:(id)body
|
||||
{
|
||||
[_bridge enqueueJSCall:@"RCTNativeAppEventEmitter.emit"
|
||||
args:body ? @[name, body] : @[name]];
|
||||
[_bridge enqueueJSCall:@"RCTNativeAppEventEmitter"
|
||||
method:@"emit"
|
||||
args:body ? @[name, body] : @[name]
|
||||
completion:NULL];
|
||||
}
|
||||
|
||||
- (void)sendDeviceEventWithName:(NSString *)name body:(id)body
|
||||
{
|
||||
[_bridge enqueueJSCall:@"RCTDeviceEventEmitter.emit"
|
||||
args:body ? @[name, body] : @[name]];
|
||||
[_bridge enqueueJSCall:@"RCTDeviceEventEmitter"
|
||||
method:@"emit"
|
||||
args:body ? @[name, body] : @[name]
|
||||
completion:NULL];
|
||||
}
|
||||
|
||||
- (void)sendInputEventWithName:(NSString *)name body:(NSDictionary *)body
|
||||
@@ -81,8 +85,10 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
|
||||
name = RCTNormalizeInputEventName(name);
|
||||
[_bridge enqueueJSCall:@"RCTEventEmitter.receiveEvent"
|
||||
args:body ? @[body[@"target"], name, body] : @[body[@"target"], name]];
|
||||
[_bridge enqueueJSCall:@"RCTEventEmitter"
|
||||
method:@"receiveEvent"
|
||||
args:body ? @[body[@"target"], name, body] : @[body[@"target"], name]
|
||||
completion:NULL];
|
||||
}
|
||||
|
||||
- (void)sendTextEventWithType:(RCTTextEventType)type
|
||||
|
||||
@@ -228,8 +228,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
@"initialProps": _appProperties ?: @{},
|
||||
};
|
||||
|
||||
[bridge enqueueJSCall:@"AppRegistry.runApplication"
|
||||
args:@[moduleName, appParameters]];
|
||||
[bridge enqueueJSCall:@"AppRegistry"
|
||||
method:@"runApplication"
|
||||
args:@[moduleName, appParameters]
|
||||
completion:NULL];
|
||||
}
|
||||
|
||||
- (void)setSizeFlexibility:(RCTRootViewSizeFlexibility)sizeFlexibility
|
||||
@@ -376,8 +378,10 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder:(nonnull NSCoder *)aDecoder)
|
||||
if (self.userInteractionEnabled) {
|
||||
self.userInteractionEnabled = NO;
|
||||
[(RCTRootView *)self.superview contentViewInvalidated];
|
||||
[_bridge enqueueJSCall:@"AppRegistry.unmountApplicationComponentAtRootTag"
|
||||
args:@[self.reactTag]];
|
||||
[_bridge enqueueJSCall:@"AppRegistry"
|
||||
method:@"unmountApplicationComponentAtRootTag"
|
||||
args:@[self.reactTag]
|
||||
completion:NULL];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user