reactnative 笔记

Posted 刘金宇

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了reactnative 笔记相关的知识,希望对你有一定的参考价值。

1、<FlatList/>

_renderItem = ({item})=>{
      return <View style={[styles.part4Row]}>
        <Text style={this.props.titleFont}>{item.name}</Text>
        <Text style={this.props.valueFont}>{item.value}</Text>
      </View>
 }

<FlatList
        data={this.state.flatListData}
        renderItem={this._renderItem}
 />

2、钩子,父组件传值变化时候,在子组件触发

componentWillReceiveProps(newProps){
    this.setState({flatListData:newProps.flatListData||[]})
}

 

以上是关于reactnative 笔记的主要内容,如果未能解决你的问题,请参考以下文章