Lydia's blog

Every day to be a little better


  • Home

  • Archives

  • Search

react-native 上拉加载更多

Posted on 2020-04-22 16:54

需要用Flatlist自己实现 现在网上的插件基本上都是listview都用不了 0.60.x之后的都用不了listview了

参考:https://juejin.im/post/5a94d26d6fb9a0636263fd16

Read more »

react-native 流加载

Posted on 2020-04-21 19:14

scrollView onMomentumScrollEnd

1
2
3
4
5
6
7
8
9
10
11
12
13
<ScrollView onMomentumScrollEnd={this.contentViewScroll}>  //这个方法调用不要加() 带括号会直接执行

contentViewScroll(e: Object){
let offsetY = e.nativeEvent.contentOffset.y; //滑动距离
let contentSizeHeight = e.nativeEvent.contentSize.height; //scrollView contentSize高度
let oriageScrollHeight = e.nativeEvent.layoutMeasurement.height; //scrollView高度
if (offsetY + oriageScrollHeight >= contentSizeHeight){
this.setState({
page: this.state.page++,
});
this.fetchData();
}
}

react-native 引入icon-font

Posted on 2020-04-21 17:44
  1. 安装 react native vector icons

    1
    2
    3
    4
    $ npm install react-native-vector-icons --save
    $ react-native link react-native-vector-icons
    $ cd ios
    $ pod install
  2. 使用 iconfont-自定义字体 我们这里是从 iconfont - 阿里巴巴矢量图图标 中选择喜欢的自定义字体,然后加入自己的项目中。

    Read more »

react-native network api

Posted on 2020-04-21 14:23
  1. 声明变量

    1
    2
    3
    4
    5
    6
    constructor(props) {
    super(props);
    this.state = {
    jobs: null,
    };
    }
    Read more »

react-native page 样式

Posted on 2020-04-21 10:54

RN中有很多在css踩的坑 在这个blog中记录一下

样式如果报了语法错误 改了之后log中没有报错 但是模拟机还是报错的话 就重新运行一下

参考:https://reactnative.cn/docs/layout-props/

Read more »

react-native component生命周期

Posted on 2020-04-20 19:21

image-20200420195239187

组件的生命周期分为三个阶段,分别是挂载(mounting)、更新(updating)和卸载(Unmounting),其中挂载和更新阶段都会调用render方法进行绘制。

Read more »

react-native page写法

Posted on 2020-04-20 14:23
  1. 创建一个setup.js文件

    Read more »

react-native 报错解决

Posted on 2020-04-18 17:58
  1. BatchedBridge error in React Native on iOS

    将index.js文件改成index.ios.js

    Read more »

react-navigation navbar使用

Posted on 2020-04-17 14:23
  1. 安装 $npm install –save react-navigation

    ​ $npm install –save react-navigation-stack

  2. 在App.js引入插件

    1
    import { createStackNavigator } from 'react-navigation-stack';
    Read more »

React-native ios框架搭建

Posted on 2020-04-13 17:19
  1. npm install -g react-native-cli

  2. react-native init MyProject

  3. 将已有native项目更名为 ios 拖动到项目里替换掉已有文件夹

    Read more »
123…28

Lydia

This is lydia's blog

277 posts
1 categories
46 tags
© 2020 Lydia
Powered by Hexo
|
Theme — NexT.Muse v5.1.4