Check out example codes for "swift go to root view controller". It will help you in understanding the concepts better.

Code Example 1

// For Navigation
self.navigationController?.popToRootViewController(animated: true)
// For Presenting modally
self.view.window!.rootViewController?.dismissViewControllerAnimated(false, completion: nil)

Learn ReactJs, React Native from akashmittal.com