1
votes

We are planning to develop a custom react-native mobile app where we need to display lightning app pages in mobile webview through lightningout.js.

We created a react-native app using forcereact (Salesforce mobile sdk), and we can successfully login and get the OAuth token. Our requirement to show lightning component pages in in react-native webview through lightning out. To do that, we should pass the oAuth token to webview in securely. Is there any way to pass the token to react-native webview?

1

1 Answers

0
votes

Not very clear about your question.But if you are trying to interactive between the html page and the react-native.You can use postMessage and onMessage.

export default class Test extends React.Component{
    constructor(props){
        super(props);
    }

    handleMessage(msg){

    }

    postMessage(msg){
        this.webview.postMessage(msg)
    }

    render(){
        return (
            <Webview 
                source={{uri:"http://test.com"}}
                onMessage={this.handleMessage}
                ref={ref => { this.webview = ref }}
            />
        )
    }

}