ReactNative 的几个小Tips

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/j550341130/article/details/82589503
  1. 自定义控件内部的Component的刷新时可以这样实现: this.refs.viewInFather.refs.viewInChild.setState(...), 类似于android里的 findViewById 获取到 FatherView, 然后 fatherView.findViewById获取到ChildView; 可以这样理解: Component 就是 android 里面的 View, refs就相当于findViewById, 这个 Component 内定义的方法 ( 包括setState ) 都可以在获取到此view时直接调用.
  2. FlatList 的 data 列表 如果没有变化, 有要求 FlatList 刷新的话, 可以给 FlatList 添加此属性: extraData={this.state}
  3. 输入法显示隐藏时均会刷新界面, 导致各组件的render被调用, 这机制你敢信?

猜你喜欢

转载自blog.csdn.net/j550341130/article/details/82589503