I have a ListView component which is receiving state updates through redux. The component code is:
import React, {
Component,
PropTypes,
View,
Text,
StyleSheet,
ListView
} from 'react-native';
export default class Feed extends Component {
constructor(props) {
super(props);
this.ds = new ListView.DataSource({rowHasChanged: (row1, row2) => row1 !== row2});
this.state = {
dataSource: this.ds.cloneWithRows(this.props.items),
}
}
componentWillReceiveProps(nextProps) {
this.setState({
dataSource: this.ds.cloneWithRows(nextProps.items)
});
}
renderRow(rowData) {
console.log('my data');
console.log(rowData.body.text);
return(
<View>
<Text>{rowData.body.text}</Text>
</View>
);
}
render() {
const style = StyleSheet.create({
helloWorld: {
color: 'red',
textAlign: 'center',
}
});
return (
<View>
<ListView dataSource={this.state.dataSource} renderRow={(rowData) => {this.renderRow(rowData)}} />
</View>
);
}
}
Feed.propTypes = {
items: PropTypes.array.isRequired,
}
The List data is coming from an external callout. When the callout is complete the property items is updated and passed through (using redux in the containing component). The console tells me that renderRow is called with the new data but I am receiving a blank screen still. Any ideas? Expecting this to be something stupid.