more changes
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Home screen with logo and connect button
|
||||
*/
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
Dimensions,
|
||||
View,
|
||||
ImageBackground,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
Permissions,
|
||||
AsyncStorage
|
||||
} from 'react-native';
|
||||
import {
|
||||
Actions
|
||||
} from 'react-native-router-flux';
|
||||
|
||||
const windowWidth = Dimensions.get('window').width;
|
||||
const windowHeight = Dimensions.get('window').height;
|
||||
const backgroundLink = 'https://cdn.shopify.com/s/files/1/2567/6484/products/Polygon_Esprit_geometric_white_and_gold_5.jpg?v=1517325402';
|
||||
|
||||
type Props = {};
|
||||
export default class Home extends Component<Props> {
|
||||
connect() {
|
||||
Actions.loading();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={homeStyles.container}>
|
||||
<ImageBackground style={homeStyles.bg} source={{uri : backgroundLink}} >
|
||||
<View>
|
||||
<Text style={homeStyles.logo}>Nexto</Text>
|
||||
<Text style={homeStyles.motto}>spontaneous connection</Text>
|
||||
</View>
|
||||
|
||||
<TouchableOpacity style={homeStyles.connect} onPress={this.connect.bind(this)}>
|
||||
<Text style={homeStyles.connectTxt}>Connect</Text>
|
||||
</TouchableOpacity>
|
||||
</ImageBackground>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const homeStyles = {
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: '#0e8f9e',
|
||||
},
|
||||
bg: {
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'space-around',
|
||||
alignItems: 'center',
|
||||
width: windowWidth,
|
||||
height: windowHeight
|
||||
},
|
||||
logo: {
|
||||
color: 'grey',
|
||||
fontSize: 50,
|
||||
textAlign: 'center',
|
||||
zIndex: 100
|
||||
},
|
||||
motto: {
|
||||
color: '#0e8f9e',
|
||||
fontSize: 18
|
||||
},
|
||||
connect: {
|
||||
backgroundColor: '#0e8f9e',
|
||||
padding: 15,
|
||||
width: windowWidth - 100,
|
||||
justifyContent: 'flex-end',
|
||||
},
|
||||
connectTxt: {
|
||||
textAlign: 'center',
|
||||
color: 'white',
|
||||
fontSize: 25
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Universal Loading screen that can be used for any situations
|
||||
*/
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
Dimensions,
|
||||
View,
|
||||
Image,
|
||||
Text,
|
||||
AsyncStorage
|
||||
} from 'react-native';
|
||||
import {
|
||||
Actions
|
||||
} from 'react-native-router-flux';
|
||||
|
||||
const windowWidth = Dimensions.get('window').width;
|
||||
const windowHeight = Dimensions.get('window').height;
|
||||
const loadingGIF = 'http://www.playrosy.com/ourgames/vampiregirlmakeover/images/_preloader.gif';
|
||||
|
||||
type Props = {};
|
||||
export default class Loading extends Component<Props> {
|
||||
componentWillMount() {
|
||||
// Getting the location of the user
|
||||
navigator.geolocation.getCurrentPosition((position) => {
|
||||
console.log('Getting User Location:');
|
||||
this.latitude = parseFloat(position.coords.latitude);
|
||||
this.longitude = parseFloat(position.coords.longitude);
|
||||
console.log(String(this.latitude) + ' ' + String(this.longitude));
|
||||
//AsyncStorage.setItem('longitude', this.longitude);
|
||||
//AsyncStorage.setItem('latitude', this.latitude);
|
||||
Actions.main();
|
||||
},
|
||||
(error) => console.log(error),
|
||||
// high accuracy might need slight adjusting with its values
|
||||
// or perhaps do high accuracy and if it times out then do
|
||||
// regular getPosition
|
||||
//{ enableHighAccuracy: false, timeout: 2000, maximumAge: 1000 }
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={loadingStyles.container}>
|
||||
<Image style={loadingStyles.gif} source={{ uri: null }} />
|
||||
<Text style={loadingStyles.waitTxt}>Please wait to be connected...</Text>
|
||||
<View style={loadingStyles.copyright}>
|
||||
<Text style={loadingStyles.copyTxt}>© Nexto</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const loadingStyles = {
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column',
|
||||
backgroundColor: '#0e8f9e',
|
||||
},
|
||||
gif: {
|
||||
height: 50,
|
||||
width: 50
|
||||
},
|
||||
waitTxt: {
|
||||
color: 'white',
|
||||
fontSize: 15
|
||||
},
|
||||
copyright: {
|
||||
position: 'absolute',
|
||||
bottom: 30,
|
||||
zIndex: 10
|
||||
},
|
||||
copyTxt: {
|
||||
fontSize: 15,
|
||||
color: 'white',
|
||||
fontFamily: 'TitilliumWeb-Regular'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Main screen with top Navbar, chat scroll view,
|
||||
* and Ad space components
|
||||
*/
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
Dimensions,
|
||||
View,
|
||||
Text
|
||||
} from 'react-native';
|
||||
import {
|
||||
Actions
|
||||
} from 'react-native-router-flux';
|
||||
|
||||
// imported components for different sections in main component
|
||||
import Navbar from './main/navbar.js';
|
||||
import Chat from './main/chat.js';
|
||||
import AdSpace from './main/adspace.js';
|
||||
|
||||
const windowWidth = Dimensions.get('window').width;
|
||||
const windowHeight = Dimensions.get('window').height;
|
||||
|
||||
type Props = {};
|
||||
export default class Main extends Component<Props> {
|
||||
render() {
|
||||
console.log('in Main');
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.navbar}>
|
||||
<Navbar />
|
||||
</View>
|
||||
<View style={styles.chat}>
|
||||
<Chat />
|
||||
</View>
|
||||
<View style={styles.adspace}>
|
||||
<AdSpace />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = {
|
||||
container: {
|
||||
flex: 18,
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'space-between'
|
||||
},
|
||||
navbar: {
|
||||
flex: 2
|
||||
},
|
||||
chat: {
|
||||
flex: 15,
|
||||
backgroundColor: 'white'
|
||||
},
|
||||
adspace: {
|
||||
flex: 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user