[ad_1]
I’m new to constructing modules in react native and making an attempt to construct a local module with react native module, for some purpose I get. I’ve googled on-line and it says simply add the imports to your bridging file to reveal object-c code to swift however appears its not occurring for me. unsure if i missed one thing or i’m lacking one thing.
can not discover kind 'RCTPromiseRejectBlock' in scope
can not discover kind 'RCTPromiseResolveBlock' in scope
I included <React/RCTBridgeModule.h> in my AppName-Bridging-Header.m file however nonetheless similar end result, i’ve eliminated all node_modules, podfile and rebuild and nonetheless similar drawback.
# App-Bridging-Header.m
#import <React/RCTBridgeModule.h>
#import <React/RCTViewManager.h>
#import <React/RCTConvert.h>
ModuleFile.m
#import <Basis/Basis.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTConvert.h>
@interface RCT_EXTERN_MODULE(Vgas, NSObject)
RCT_EXTERN_METHOD(multiply:(float)a withB:(float)b
withResolver:(RCTPromiseResolveBlock)resolve
withRejecter:(RCTPromiseRejectBlock)reject)
@finish
#swift file
import Basis
@objc(Vgas)
class Vgas: NSObject {
@objc(multiply:withB:withResolver:withRejecter:)
func multiply(a: Float, b: Float, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
resolve(a*b)
}
}
[ad_2]

