Пример #1
0
 componentWillReceiveProps(nextProps) {
   if (nextProps.otherUserId && nextProps.chatURL) {
     this.firebaseRef = database().ref(`chats/${nextProps.chatURL}/messages`);
     if (typeof this.firebaseRefs["chats"] === "undefined") {
       this.bindAsArray(this.firebaseRef, "chats");
     }
   }
 }
Пример #2
0
 constructor(props) {
   super(props);
   this.firebaseDB = database();
   this.currentChat = null;
   this.timeoutRef = null;
   this.userInput = null;
   this.chatMessageRef = null;
   autoBind(this);
 }
Пример #3
0
 constructor(props) {
   super(props);
   this.state = {
     chatURL: null,
     otherUserId: null,
     showCloseBtn: false,
     showIntroScreen: utility.showIntroScreen(),
     showSpinner: true
   };
   this.firebaseDB = database();
   this.firebaseChatRef = this.firebaseDB.ref("chats");
   this.firebaseUserRef = null;
   this.firebaseDBTyping = null;
   this.firebaseChatDisconnection = null;
   this.userId = window.navigator.userAgent.replace(/\D+/g, "");
   autoBind(this);
 }
 // database
 get database() {
   return db();
 }