will fix asyncstorage later

midterm solution - passing lat and long as props
This commit is contained in:
Arjun Patel
2018-06-29 21:32:50 -07:00
parent 43ece13696
commit 6189437670
4 changed files with 65 additions and 9 deletions
+7 -6
View File
@@ -34,8 +34,11 @@ export default class Chat extends Component<Props> {
messagesDOM: [],
prevMessageUser: -1
};
/**
* todo fix AsyncStorage
*/
this.getValues(); // from AsyncStorage
this.position = this.props.position;
}
getValues = async () => {
@@ -57,9 +60,7 @@ export default class Chat extends Component<Props> {
componentDidMount() {
this.socket = io('10.0.2.2:3000', {jsonp: false});
this.socket.on('connect', () => {
var position = {long: this.long, lat: this.lat};
console.log(position);
this.socket.emit('initial', position);
this.socket.emit('initial', this.position);
});
this.socket.on('initMessages', (allMsg) => {
@@ -97,8 +98,8 @@ export default class Chat extends Component<Props> {
this.socket.emit('newMessage', {
userId: this.userId,
text: this.state.messageToSend,
lng: this.long,
lat: this.lat
lng: this.position.long,
lat: this.position.lat
});
this.setState({
messageToSend: ''
+36
View File
@@ -0,0 +1,36 @@
/*
* Dashboard/Menu
*/
import React, { Component } from 'react';
import {
Dimensions,
View,
Text
} from 'react-native';
import {
Actions
} from 'react-native-router-flux';
import { Fonts } from '../utils/Fonts.js';
const windowWidth = Dimensions.get('window').width;
const windowHeight = Dimensions.get('window').height;
type Props = {};
export default class Dashboard extends Component<Props> {
constructor(props) {
super(props);
}
render() {
console.log('in dashboard');
return (
<View>
<Text>hasdf</Text>
</View>
);
}
}
const styles = {
}