In my class that implements the RCTBridgeModule
protocol in Xcode, I am trying to write an RCT_EXPORT_MEATHOD
that I can expose to React Native code to consume image data. Currently, I can write an image to disk in React Native, and then pass the path through to the native method, but I'm wondering if there is a better technique to pass image data directly for better performance?
So instead of this:
RCT_EXPORT_METHOD(scanImage:(NSString *)path) {
UIImage *sampleImage = [[UIImage alloc] initWithContentsOfFile:path];
[self processImage: UIImage];
}
Something more like this:
RCT_EXPORT_METHOD(scanImage:(NSData *)imageData) {
[self processImageWithData: imageData];
}