How to access rootViewController from React-Native

后端 未结 1 773
醉梦人生
醉梦人生 2021-02-15 01:03

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

1条回答
  •  执念已碎
    2021-02-15 01:36

    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;
    

    0 讨论(0)
提交回复
热议问题