react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Is it possible to push a native view controllers to TabBarIOS?

Open jhau opened this issue 11 years ago • 1 comments

Hi, is there anyway of presenting a native view controller onto the TabBarIOS component in a native module?

currently this is what I do in my native module, but it's using the rootController so it will pop the TabBarIOS component.

let rootController = UIApplication.sharedApplication().keyWindow?.rootViewController as? UINavigationController

if let viewController = rootController!.viewControllers.first as? ViewController {
      viewController.presentConversationListViewController()
}

If there anyway of finding the TabBarIOS view controller (instead of the root) and set the currently selected tab view controller?

many thanks!

Jeff

jhau avatar Aug 27 '15 07:08 jhau

This isn't supported out of the box and likely won't be (consider Android) but if you're up for it you could write this code on your own by creating a new bridged component that wraps your UIViewController.

See these files: https://github.com/facebook/react-native/blob/2f6e7336cb96bf14d47554ae0db1836075ea809e/React/Views/RCTModalHostView.m https://github.com/facebook/react-native/blob/2f6e7336cb96bf14d47554ae0db1836075ea809e/React/Views/RCTModalHostViewManager.m https://github.com/facebook/react-native/blob/2f6e7336cb96bf14d47554ae0db1836075ea809e/React/Views/RCTModalHostViewController.m

ide avatar Aug 28 '15 00:08 ide