Check out example codes for "dismiss two view controllers at once swift". It will help you in understanding the concepts better.

Code Example 1

if let first = presentingViewController,
        let second = first.presentingViewController{
          first.view.isHidden = true
          second.dismiss(animated: true)

     }

Code Example 2

self.presentingViewController?.presentingViewController?.dismiss(animated: true, completion: nil)

Learn ReactJs, React Native from akashmittal.com