Last active
April 14, 2020 07:10
-
-
Save duytq94/821e278dc238f50c94dfdb725021694e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
@IBOutlet weak var textField: UITextField! | |
@IBAction func BtnGoReactView(_ sender: Any) { | |
let messageFromNative: String = textField.text! | |
let rootView = RNViewManager.sharedInstance.viewForModule( | |
"DemoIntegrateRN", | |
initialProperties: ["message_from_native": messageFromNative]) | |
let reactNativeVC = UIViewController() | |
reactNativeVC.view = rootView | |
reactNativeVC.modalPresentationStyle = .fullScreen | |
present(reactNativeVC, animated: true) | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.hideKeyboardWhenTappedAround() | |
} | |
func hideKeyboardWhenTappedAround() { | |
let tap = UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing)) | |
tap.cancelsTouchesInView = false | |
view.addGestureRecognizer(tap) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment