How ios passes parameters to methods within react components

ios uses WKwebview, but if you want to return parameters to js, you need to call back the js method, and I think you can dispatch the parameters in the react component. Now I don"t know how to write the js method to call ios and return parameters

Mar.29,2021

have you solved it? Now I also encounter the situation that I need to adjust each other with ios. Io or Android can never be called when calling the internal methods of my react component. It seems that I can't access the internal methods of the component. They can be called if written in the index.html file. How did you solve it, please?


has not done iOS development, do not know the native details, according to your question should be able to call the JS method in WKwebview. In this way, you can bind the this scope of the React component to the callback method, and then you can access the component state on the callback method.

for example:

function callback(data){
    //  bind this 
    //  state 
    this.setState({ hello: data })
}

...

class someComponent extends React.Component {
    constructor(){
        super();
        this.state = { hello: "123" }
        callback = callback.bind(this);
    }
    ...
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4982c-44d3b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4982c-44d3b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?