Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

How to update the react native UI based on the swift delegate function?

$
0
0

I am new to the react native and I am integrating the iOS framework. I want update the UI based on the call back in Swift file.

LoginContoller:

func validateLogin(userName: String, pswd: String)  {    HKSDKController.init(withuserName: userName, password: pswd, delegate: self)}Delegate function:func recieveMessage(result: Bool, withError message: String) {// result = true}

Input.js:

 loginWithLogin = (userName, pswd) => { if (userName == '') { alert("Please enter the userName"); } else if (pswd == '') { alert("Please enter the pswd"); }else { NativeModules.LoginContoller.validateLogin(userName,pswd); } }

I saw there is a call function to update the js:

  @objc func callbackMethod(callback: RCTResponseSenderBlock) -> Void {  }

My question is i want to update the UI based on the “recieveMessage” callback function. I called the "validateLogin" function in input.js file. How to handle it and pass the result to the input js.

If the result is true in the "recieveMessage" delegate function, how to notify the js file.


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>