mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use methodSignatureForSelector instead of instanceMethodSignatureForSelector (#51366)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51366 We inherited this from the legacy native module infra, where we didn't have access to the module instance. Instead we can use the simpler `methodSignatureForSelector` which works correctly with OCMock (needed in D74815079). Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D74817191 fbshipit-source-id: 6f3f741e9a78dea967a7654e6410ddacfad6d8a3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
83ed4620d6
commit
05dee839d8
+3
-5
@@ -686,7 +686,7 @@ NSInvocation *ObjCTurboModule::createMethodInvocation(
|
||||
NSMutableArray *retainedObjectsForInvocation)
|
||||
{
|
||||
const char *moduleName = name_.c_str();
|
||||
const id<RCTBridgeModule> module = instance_;
|
||||
const NSObject<RCTBridgeModule> *module = instance_;
|
||||
|
||||
if (isSync) {
|
||||
TurboModulePerfLogger::syncMethodCallArgConversionStart(moduleName, methodName);
|
||||
@@ -694,12 +694,10 @@ NSInvocation *ObjCTurboModule::createMethodInvocation(
|
||||
TurboModulePerfLogger::asyncMethodCallArgConversionStart(moduleName, methodName);
|
||||
}
|
||||
|
||||
NSInvocation *inv =
|
||||
[NSInvocation invocationWithMethodSignature:[[module class] instanceMethodSignatureForSelector:selector]];
|
||||
NSMethodSignature *methodSignature = [module methodSignatureForSelector:selector];
|
||||
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:methodSignature];
|
||||
[inv setSelector:selector];
|
||||
|
||||
NSMethodSignature *methodSignature = [[module class] instanceMethodSignatureForSelector:selector];
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
const jsi::Value &arg = args[i];
|
||||
const std::string objCArgType = [methodSignature getArgumentTypeAtIndex:i + 2];
|
||||
|
||||
Reference in New Issue
Block a user