react native杂记
发布时间:2020-12-15 07:25:13 所属栏目:百科 来源:网络整理
导读:给Image webview 加载本地资源的时候,是需要加上require字段,然后里面再跟地址 WebView source = {require('. / index.html ')} style = {{ marginTop : 20}} onError = {this._showError.bind(this)} startInLoadingState = {true} / Image style = {styl
<WebView source={require('./index.html')} style={{marginTop: 20}} onError={this._showError.bind(this)} startInLoadingState={true}/> <Image style={styles.icon} source={require('../img/ic_four_qiche.png')} />
或者使用局域网的本地ip地址定位 <TwebView uri= 'http://192.168.0.151:8081/html/gaode_map.html'/>
//http://192.168.0.151:8081代表当前项目的根目录文件夹
adb reverse tcp:8081 tcp:8081
在这之前可以尝试一下在项目跟目录下运行 react-native start
命令 在导入第三方库的时候,不成功 后来发现,只要导入第三方库之前都要执行上面的语句,才会成功 加载更多 //注释详细 https://github.com/shiwenwen/react-native-swRefresh https://github.com/greatbsky/react-native-pull (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |