问题
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.
回答1:
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;
来源:https://stackoverflow.com/questions/29317190/how-to-access-rootviewcontroller-from-react-native