网上没找到合适的方法。用react-native-fs解决了一下,因为release之后静态文件地址发生改变,之前的引入就无效了
1.项目根目录引入静态文件的文件夹
2.创建一个html,刚才引入的地址${RNFS.MainBundlePath}/web
/**
* ./EditorHtml
*/
let RNFS = require('react-native-fs');
const htmlWeb = `
`;
export default htmlWeb;
3.引入这个html${RNFS.MainBundlePath}/web
import WEBHTML from './EditorHtml';
4.注意baseUrl
scrollEnabled={false}
ref={webview => this.webview = webview}
onMessage={this.invoke.listener}
javaScriptEnabled={true}
automaticallyAdjustContentInsets = {false}
scalesPageToFit={true}
contentInset={{left : 0,right:0,top:0,bottom:0}}
source={{html:WEBHTML,baseUrl: '/web'}}
/>