Chats Store

This store is responsible for holding all the data and logic surrounding chats and messages, but it also helps the chats store initializing when a user is logged in:

/*** src/stores/chats.js ***/ import { observable, computed, map, toJS, action } from 'mobx'; import { AsyncStorage } from 'react-native' import { firebaseApp } from '../firebase' import notifications from '../notifications' class Chats { @observable list; @observable selectedChatMessages; @observable downloadingChats = false; @observable downloadingChat = false; @action addMessages = function(chatId, contactId, messages) { //add a list of messages to a chat } @action selectChat = function(id) { //set a chat as selected and retrieve all the messages for it } @action add(user1, ...

Get React: Cross-Platform Application Development with React Native now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.