0

So the question is: Can i render the response from the back(html page) with react-native-webview?

Masuk Helal Anik
  • 2,155
  • 21
  • 29
  • Please add a little more detail. Are you wanting to post a message in which you can then read within the React Native context? Are you wanting to interact with the WebView? If so, use postMessage, are you wishing to get the HTML as a string in React Native? What are you trying to achieve? – JRK Apr 05 '19 at 12:58
  • I need to render html page with confirmation form which is send by bank in response to my post request. In this form user have to insert confirmation code to confirm the payment – Michael Tkachenko Apr 05 '19 at 13:03

2 Answers2

1

yes you can render whole html page with react-native-webview

1

I think this example will help you In web

<script>
  window.postMessage("Sending data from Web");
</script>
In React Native
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { WebView } from 'react-native-webview';

export default class App extends Component {
  
    }

    render() {
        return (
          <WebView
             ref="webview"
             onMessage={this.onMessage}
          />
        );
    }

  onMessage(data) {
  
  alert(data);
}
}
Masuk Helal Anik
  • 2,155
  • 21
  • 29