Open native camera from react native

I am new to react native and need your help. I am new to react native I am trying to integrate blink sdk with my react native app. I have exposed a native method to react native js using RCT_EXPORT_METHOD(). JS button click is invoking this native method. Now from this native method I want to open camera using:

/* Allocate and present the scanning view controller */

    UIViewController<PPScanningViewController>* scanningViewController = [coordinator cameraViewControllerWithDelegate:self];

   scanningViewController.autorotate = YES;
   scanningViewController.supportedOrientations = UIInterfaceOrientationMaskAll;

Now there are two problems:

  1. If I run it just like that, it gives me red screen saying "invoke the method on main thread".

  2. Now to run it on main thread, I added -(dispatch_queue_t)methodQueue { return dispatch_get_main_queue(); }

Still it is not running and saying not present in view hierarchy. Please help.

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

React Native - Image Cache