加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

给Image webview 加载本地资源的时候,是需要加上require字段,然后里面再跟地址

<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

命令


在导入第三方库的时候,不成功
阴差阳错,在项目目录下:npm install express -gf 再导就成功了

后来发现,只要导入第三方库之前都要执行上面的语句,才会成功

加载更多
//导包 npm install react-native-swRefresh –save

//注释详细

https://github.com/shiwenwen/react-native-swRefresh

https://github.com/greatbsky/react-native-pull

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读