/* * Chat component within Main */ import React, { Component } from 'react'; import { Dimensions, View, Text, TextInput, Image } from 'react-native'; import { Actions } from 'react-native-router-flux'; import Icon from 'react-native-vector-icons/MaterialIcons'; import { Fonts } from '../../utils/Fonts.js'; const windowWidth = Dimensions.get('window').width; const windowHeight = Dimensions.get('window').height; type Props = {}; export default class Chat extends Component { constructor(props) { super(props); var exMessages = [ { id: 1, text: "hey anyone wanna study 61A" }, { id: 2, text: "Yea im down" } ]; this.state = { messageToSend : '', messagesDOM: exMessages.map( (msg) => {msg.text} ) }; } messageInput = (text) => { console.log('changing state of messageToSend'); this.setState({ messageToSend : text }); console.log(this.state.messageToSend); } render() { console.log(this.state.messagesDOM); return ( {this.state.messagesDOM.length == 0 ? ( No one's talkin around you! Start it up! ) : ( {this.state.messagesDOM} ) } cra ); } } const styles = { container: { flex: 1, flexDirection: 'column', justifyContent: 'flex-end', backgroundColor: '#e8ebef' }, chatField: { flex: 8, flexDirection: 'column', justifyContent: 'flex-end', alignItems: 'center' }, chatFieldEmpty: { flex: 8, flexDirection: 'column', justifyContent: 'center', alignItems: 'center' }, inputMsgField: { flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', height: 50, backgroundColor: 'white' }, iconCont: { flex: 1, alignItems: 'center', justifyContent: 'center' }, inputCont: { flex: 6, alignSelf: 'flex-end' }, inputField : { fontSize: 18, fontFamily: Fonts.SunflowerLight }, sendIcon: { fontSize: 25 } }