diff --git a/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.h b/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.h index 42dfd285928..abf072a2b78 100644 --- a/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.h +++ b/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.h @@ -40,7 +40,6 @@ class JSI_EXPORT ObjCTurboModule : public TurboModule { id instance; std::shared_ptr jsInvoker; std::shared_ptr nativeInvoker; - // Does the NativeModule dispatch async methods to the JS thread? bool isSyncModule; }; @@ -61,16 +60,20 @@ class JSI_EXPORT ObjCTurboModule : public TurboModule { void setMethodArgConversionSelector(NSString *methodName, int argIndex, NSString *fnName); private: + // Does the NativeModule dispatch async methods to the JS thread? + const bool isSyncModule_; + /** * TODO(ramanpreet): * Investigate an optimization that'll let us get rid of this NSMutableDictionary. */ NSMutableDictionary *methodArgConversionSelectors_; NSDictionary *> *methodArgumentTypeNames_; - const bool isSyncModule_; - bool isMethodSync(TurboModuleMethodValueKind returnType); - NSString *getArgumentTypeName(NSString *methodName, int argIndex); + bool isMethodSync(TurboModuleMethodValueKind returnType); + BOOL hasMethodArgConversionSelector(NSString *methodName, int argIndex); + SEL getMethodArgConversionSelector(NSString *methodName, int argIndex); + NSString *getArgumentTypeName(NSString *methodName, int argIndex); NSInvocation *getMethodInvocation( jsi::Runtime &runtime, TurboModuleMethodValueKind returnType, @@ -86,9 +89,6 @@ class JSI_EXPORT ObjCTurboModule : public TurboModule { NSInvocation *inv, NSMutableArray *retainedObjectsForInvocation); - BOOL hasMethodArgConversionSelector(NSString *methodName, int argIndex); - SEL getMethodArgConversionSelector(NSString *methodName, int argIndex); - using PromiseInvocationBlock = void (^)(RCTPromiseResolveBlock resolveWrapper, RCTPromiseRejectBlock rejectWrapper); jsi::Value createPromise(jsi::Runtime &runtime, std::shared_ptr jsInvoker, PromiseInvocationBlock invoke); diff --git a/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm b/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm index b44010d0304..4e5cdc8a4ee 100644 --- a/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm +++ b/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm @@ -361,7 +361,7 @@ jsi::Value ObjCTurboModule::performMethodInvocation( }; if (wasMethodSync) { - nativeInvoker_->invokeSync([block]() -> void { block(); }); + block(); } else { asyncCallCounter = getUniqueId(); TurboModulePerfLogger::asyncMethodCallDispatch(moduleName, methodName);