title: how do I pass image data to a native module in React Native?
body: <p>In my class that implements the <code>RCTBridgeModule</code> protocol in Xcode, I am trying to write an <code>RCT_EXPORT_MEATHOD</code> 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?</p>
  
  <p><strong>So instead of this:</strong></p>
  
  <pre><code>RCT_EXPORT_METHOD(scanImage:(NSString *)path) {
    UIImage *sampleImage = [[UIImage alloc] initWithContentsOfFile:path];  
    [self processImage: UIImage];
  }
  </code></pre>
  
  <p><strong>Something more like this:</strong></p>
  
  <pre><code>RCT_EXPORT_METHOD(scanImage:(NSData *)imageData) {
    [self processImageWithData: imageData];
  }
  </code></pre>