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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.