如何在React Native中的WebView中使用源而不是html

Nim*_*nya 2 webview react-native

最近,React Native已弃用html并使用url道具替换它们source.

<WebView
    automaticallyAdjustContentInsets={false}
    contentInset={{top: 0, right: 0, bottom: 0, left: 0}}
    html={"<style>*{margin:0;padding:0;}canvas{position:absolute;transform:translateZ(0);}</style><canvas></canvas><script>var canvas = document.querySelector('canvas');(" + renderString + ").call(" + contextString + ", canvas);</script>"}
    opaque={false}
    underlayColor={'transparent'}
    style={this.props.style}
    javaScriptEnabled={true}
/>
Run Code Online (Sandbox Code Playgroud)

如何更换html使用source.只是替换不起作用.提前致谢.

Joh*_*mas 18

<WebView source={{ html: "<h1>Hello</h1>" }} />
Run Code Online (Sandbox Code Playgroud)

此处提供的文档:http://facebook.github.io/react-native/docs/webview.html#content