import React, { Component } from 'react'; import { Text, ListView } from 'react-native'; class Chat extends Component { componentWillMount() { this.createDataSource(this.props); } componentWillReceiveProps(nextProps) { this.createDataSource(nextProps); } createDataSource({messages}){ const ds = new ListView.DataSource({ rowHasChanged: (r1,r2) => r1 !== r2 }); this.dataSource = ds.cloneWithRows(messages); } renderRow({time,user,text}) { return [{time}] {user}: {text}; } render() { return ( ); } }; export default Chat;