Main home screen and loading screen
Routing, basic pages done, asyncstorage started, geolocationing working with emulator, need to change to 2 spaces
This commit is contained in:
@@ -140,6 +140,7 @@ dependencies {
|
|||||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||||
compile "com.android.support:appcompat-v7:23.0.1"
|
compile "com.android.support:appcompat-v7:23.0.1"
|
||||||
compile "com.facebook.react:react-native:+" // From node_modules
|
compile "com.facebook.react:react-native:+" // From node_modules
|
||||||
|
compile 'com.facebook.fresco:animated-gif:1.0.1' // for gif support
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run this once to be able to run the application with BUCK
|
// Run this once to be able to run the application with BUCK
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".MainApplication"
|
android:name=".MainApplication"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
+14
-41
@@ -1,9 +1,6 @@
|
|||||||
/**
|
/*
|
||||||
* Sample React Native App
|
* Main file that overlooks entire app routing
|
||||||
* https://github.com/facebook/react-native
|
|
||||||
* @flow
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import {
|
import {
|
||||||
Platform,
|
Platform,
|
||||||
@@ -17,47 +14,23 @@ import {
|
|||||||
Stack
|
Stack
|
||||||
} from 'react-native-router-flux';
|
} from 'react-native-router-flux';
|
||||||
|
|
||||||
const instructions = Platform.select({
|
// Imported screens to route through
|
||||||
ios: 'Press Cmd+R to reload,\n' +
|
import Home from './screens/home.js';
|
||||||
'Cmd+D or shake for dev menu',
|
import Loading from './screens/loading.js';
|
||||||
android: 'Double tap R on your keyboard to reload,\n' +
|
|
||||||
'Shake or press menu button for dev menu',
|
|
||||||
});
|
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
export default class App extends Component<Props> {
|
export default class App extends Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<Router>
|
||||||
<Text style={styles.welcome}>
|
<Stack key='root' style={{paddingTop: 54}}>
|
||||||
Welcome to React !
|
<Scene key='home' component={Home} title="Home" hideNavBar={true} />
|
||||||
</Text>
|
<Scene key='loading' component={Loading} title='Loading' />
|
||||||
<Text style={styles.instructions}>
|
{/*
|
||||||
To get started, edit App.js
|
<Scene key='chat' component={Chat} title='Chat' hideNavBar={false} />
|
||||||
</Text>
|
*/}
|
||||||
<Text style={styles.instructions}>
|
</Stack>
|
||||||
{instructions}
|
</Router>
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
container: {
|
|
||||||
flex: 1,
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
backgroundColor: '#F5FCFF',
|
|
||||||
},
|
|
||||||
welcome: {
|
|
||||||
fontSize: 20,
|
|
||||||
textAlign: 'center',
|
|
||||||
margin: 10,
|
|
||||||
},
|
|
||||||
instructions: {
|
|
||||||
textAlign: 'center',
|
|
||||||
color: '#333333',
|
|
||||||
marginBottom: 5,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
@@ -0,0 +1,2 @@
|
|||||||
|
Main Theme
|
||||||
|
Nexto color: #0e8f9e
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* Home screen with logo and connect button
|
||||||
|
*/
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import {
|
||||||
|
View,
|
||||||
|
ImageBackground,
|
||||||
|
Dimensions,
|
||||||
|
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> {
|
||||||
|
componentDidMount() {
|
||||||
|
console.log('mounted');
|
||||||
|
await AsyncStorage.getItem('longitude').then((lon) => {
|
||||||
|
console.log(lon);
|
||||||
|
});
|
||||||
|
await AsyncStorage.getItem('latitude').then((lat) => {
|
||||||
|
console.log(lat);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
View,
|
||||||
|
Dimensions,
|
||||||
|
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.home();
|
||||||
|
},
|
||||||
|
(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: 'http://www.playrosy.com/ourgames/vampiregirlmakeover/images/_preloader.gif' }} />
|
||||||
|
<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'
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+1096
-328
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -8,7 +8,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "16.3.1",
|
"react": "16.3.1",
|
||||||
"react-native": "0.55.3"
|
"react-native": "^0.55.3",
|
||||||
|
"react-native-router-flux": "^4.0.0-beta.28"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-jest": "22.4.3",
|
"babel-jest": "22.4.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user