Chat
To keep our code succinct and maintainable, we will use GiftedChat
for rendering all the messages in a chat, but there is still some work we need to do to properly render this screen:
/*** src/screens/Chat.js ***/ import React, { PropTypes } from 'react' import { View, Image, ActivityIndicator } from 'react-native'; import { observer, inject } from 'mobx-react/native' import { GiftedChat } from 'react-native-gifted-chat' @inject('chats', 'users') @observer class Chat extends React.Component { static navigationOptions = ({ navigation, screenProps }) => ({ title: navigation.state.params.name, headerRight: <Image source={{uri: navigation.state.params.image}} style={{ width: 30, height: 30, borderRadius: 15, marginRight: 10, resizeMode: 'cover' }}/> }) onSend(messages) { this.props.chats.addMessages(this.chatId, this.contactId, messages); } componentWillMount() { this.contactId = this.props.navigation.state...