Search code examples
react-nativegoogle-payreact-native-webview

Can I render hole HTML page with react-native-webview?


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


Solution

  • 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);
    }
    }