Check out example codes for "xcode hide keyboard when touch background storyboard". It will help you in understanding the concepts better.

Code Example 1

override func viewDidLoad()
    {
        super.viewDidLoad()
        
        //Hide Keyboard
        let tap = UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing))
        view.addGestureRecognizer(tap)
    }

Learn ReactJs, React Native from akashmittal.com