Skip to content

Commit

Permalink
Update GloChat
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaminus committed Nov 3, 2017
1 parent ae42320 commit 21e0a7a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
16 changes: 15 additions & 1 deletion app/components/Backend.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import firebase from "react-native-firebase";

class Backend {
uid = "";
messagesRef = null;

constructor() {
firebase.auth().onAuthStateChanged(user => {
if (user) {
this.setUid(user.uid);
} else {
firebase
.auth()
.signInAnonymously()
.catch(error => {
alert(error.message);
});
}
});
}
setUid(value) {
this.uid = value;
}
Expand Down
13 changes: 5 additions & 8 deletions app/components/GloChat.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import React, { Component, PropTypes } from 'react';
import { Text, View, StyleSheet } from "react-native";
import Backend from "../Backend";

import Backend from "./Backend";

import { GiftedChat } from "react-native-gifted-chat";

class GloChat extends React.Component {
constructor(props){
super(props);
Expand Down Expand Up @@ -42,17 +45,11 @@ class GloChat extends React.Component {
Backend.closeChat();
}
}
GloChat.defaultProps = {
name: ""
};
GloChat.prototypes = {
name: React.PropTypes.string
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
backgroundColor: "gray"
}
});
export default Chat;
export default GloChat;

0 comments on commit 21e0a7a

Please sign in to comment.