react native杂记

来源:互联网 发布:买水果软件 编辑:程序博客网 时间:2024/05/07 10:43

给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

0 0
原创粉丝点击