FlatList列表页,其render子项

<TouchableOpacity style={styles.content} onPress={()=>this._toOrderHomepage()} activeOpacity={0.5}>

</TouchableOpacity>

_toOrderHomepage(){
    //执行跳转操作报如下错误

}

RN-消息列表页页面跳转报错解决


原因:this作用域导致

RN-消息列表页页面跳转报错解决

应绑定this

<FlatList
    data={this.state.messageItemList}
    renderItem={this._renderItem.bind(this)}
    keyExtractor={this._keyExtractor.bind(this)}
    onRefresh={this._onRefresh.bind(this)}//下拉刷新操作
    refreshing={this.state.isRefreshing}//是否显示下拉刷新图标
    onEndReached={this._onEndReached.bind(this)}
    onEndReachedThreshold={0.1}
/>

相关文章:

  • 2021-07-13
  • 2022-01-13
  • 2021-12-13
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2021-04-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2022-03-08
  • 2022-02-26
  • 2022-02-10
  • 2022-12-23
相关资源
相似解决方案