出现Data没有定义
来源:6-3 Trending(趋势)模块的列表页面实现
qiankunli
2017-05-14
loadData () { this.setState({ isLoading:true }) let url = this.getUrl('?since=daily',this.props.tabLabel); this.dataTool.fetchNetworking(url) .then(result => { this.setState({ dataSource:this.state.dataSource.cloneWithRows(result), isLoading: false, }) }) .catch(error => { this.setState({ result:JSON.stringify(error), isLoading: false, }) }) } getUrl(timeRange, keyword){ return BASE_URL + keyword + timeRange; } renderRow (data) { return <TrendingCell onSelect={(data) => this.onSelect(data)} data={data} /> }
写回答
2回答
-
CrazyCodeBoy
2017-05-14
看一下为ListView设置的renderRow的属性是否正确呢?,可参考:
render() { return <View style={styles.container}> <ListView dataSource={this.state.dataSource} renderRow={(data)=>this.renderRow(data)} refreshControl={ <RefreshControl title='Loading...' titleColor={this.props.theme.themeColor} colors={[this.props.theme.themeColor]} refreshing={this.state.isLoading} onRefresh={()=>this.loadData()} tintColor={this.props.theme.themeColor} /> } /> </View> }
022017-08-09 -
qiankunli
提问者
2017-05-14
Popular页面是object 而Trending页面返回的是一个Model!
012017-08-09
相似问题