Posts

Showing posts with the label delegates

React Native and Objective C delegates

React Native and Objective C delegates I am quite new to react native and and the bridging mechanism with native code, especially when the framework has delegates. Assume I am trying to bridge the following framework: @protocol BRPtouchNetworkDelegate; @class PLNetworkModule; @interface BRPtouchNetworkManager : NSObject <NSNetServiceBrowserDelegate,NSNetServiceDelegate> @property(retain, nonatomic) NSMutableArray* registeredPrinterNames; @property(assign, nonatomic) BOOL isEnableIPv6Search; - (int)startSearch: (int)searchTime; - (NSArray*)getPrinterNetInfo; - (BOOL)setPrinterNames:(NSArray*)strPrinterNames; - (BOOL)setPrinterName:(NSString*)strPrinterName; - (id)initWithPrinterNames:(NSArray*)strPrinterNames; - (id)initWithPrinterName:(NSString*)strPrinterName; @property (nonatomic, assign) id <BRPtouchNetworkDelegate> delegate; @end @protocol BRPtouchNetworkDelegate <NSObject> -(void) didFinishSearch:(id)sender; @end The following is the bridge module I implemented: ...