Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access rootViewController from React-Native

I'm creating react-native module to access Admob. But the GADBannerView object requires rootViewController to perform. Do you know how to create react-native View/Module to do it? Thank you very much.

like image 824
Trương Hoàng Dũng Avatar asked Mar 28 '15 12:03

Trương Hoàng Dũng


1 Answers

From the native objective C code in your module, you can access the root view controller of the app as follows:

UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
like image 130
Nick Lockwood Avatar answered Sep 20 '22 06:09

Nick Lockwood