content: /**
   * Sample React Native App
   * https://github.com/facebook/react-native
   * @flow
   */
  
  import React, { Component } from 'react';
  import { Chat } from 'react-native-superchat';
  import messages from './data/messages'
  import {
    Platform,
    StyleSheet,
    Text,
    View
  } from 'react-native';
  
  export default class App extends Component {
  
    state = {
      messages: messages
    }
  
    constructor(props) {
      super(props);
      this.handleOnSend = this.handleOnSend.bind(this);
    }
  
    render() {
      return (
        <Chat 
          messages={this.state.messages} 
          user={{id: 1}}
          onSend={this.handleOnSend}
        />
      );  
    }
  
    handleOnSend(msg) {
      this.setState({messages: this.state.messages.concat(msg)}, () => {
        const response = { 
          text: 'OK',
          messageId: (new Date()).getTime(),     
          user: { ...msg.user, id: 2}
        };     
        setTimeout(() => {
          this.setState({messages: this.state.messages.concat(response)});
        }, 1000);
      });
    }
  }
  
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      justifyContent: 'center',
      alignItems: 'center',
      backgroundColor: '#F5FCFF',
    },
    welcome: {
      fontSize: 20,
      textAlign: 'center',
      margin: 10,
    },
    instructions: {
      textAlign: 'center',
      color: '#333333',
      marginBottom: 5,
    },
  });
  