Skip to content

Instantly share code, notes, and snippets.

import {
Text,
View,
StyleSheet,
Button,
Animated,
Dimensions,
ScrollView,
Image,
TouchableOpacity,
{
currentUser: "XYZ",
conversations: [
{
user: "ABC",
messages: [
{ message1: "ABC#Hello World" , Date: 1827328 },
{ message2: "XYZ#Hi whatsup??", Date: 1827328 },
{ message3: "ABC#Hello buddy...", Date: 1827328 }
]
import React, { Component } from 'react'
import './chat.css'
import io from "socket.io-client";
import UserList from './userlist';
export default class Chat extends Component {
constructor(props){
super(props);
import React, { Component } from 'react'
import './chat.css'
import io from "socket.io-client";
import UserList from './userlist';
export default class Chat extends Component {
constructor(props){
super(props);
import React, { Component } from 'react'
import './chat.css'
import io from "socket.io-client";
import UserList from './userlist';
import { connect } from 'react-redux';
import { saveAuthor } from '../../store/actions/authorAction'
import { saveMessages } from '../../store/actions/messageAction'
class Chat extends Component {
import { SAVE_AUTHOR, SAVE_MESSAGES, DELETE_AUTHOR, DELETE_MESSAGE } from '../actions/types';
const initialState = {
author: '',
message: '',
messages: []
}
export default function (state = initialState, action) {
switch (action.type) {
@aditodkar
aditodkar / chat.js
Last active November 25, 2018 16:11
import React, { Component } from 'react'
import './chat.css'
import io from "socket.io-client";
import { connect } from 'react-redux';
import { saveAuthor } from '../../store/actions/authorAction'
import { saveMessages } from '../../store/actions/messageAction'
import { deleteAuthor } from '../../store/actions/deleteAuthorAction'
import { fetchUsers } from '../../store/actions/userAction'
class Chat extends Component {
import React, { Component } from 'react'
import './chat.css'
import io from "socket.io-client";
import { connect } from 'react-redux';
import { saveAuthor } from '../../store/actions/authorAction'
import { saveMessages } from '../../store/actions/messageAction'
import { deleteAuthor } from '../../store/actions/deleteAuthorAction'
import { fetchUsers } from '../../store/actions/userAction'
import { removeMessages } from '../../store/actions/removemessagesAction'
import React, { Component } from 'react'
import './chat.css'
import io from "socket.io-client";
import { connect } from 'react-redux';
import { saveAuthor } from '../../store/actions/authorAction'
import { saveMessages } from '../../store/actions/messageAction'
import { deleteAuthor } from '../../store/actions/deleteAuthorAction'
import { fetchUsers } from '../../store/actions/userAction'
import { removeMessages } from '../../store/actions/removemessagesAction'
import { SAVE_AUTHOR, SAVE_MESSAGES, DELETE_AUTHOR } from '../actions/types';
const initialState = {
author: '',
message: '',
messages: []
}
export default function (state = initialState, action) {
switch (action.type) {