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 "com.android.support:appcompat-v7:23.0.1"
|
||||
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
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
android:label="@string/app_name"
|
||||
|
||||
+14
-41
@@ -1,9 +1,6 @@
|
||||
/**
|
||||
* Sample React Native App
|
||||
* https://github.com/facebook/react-native
|
||||
* @flow
|
||||
/*
|
||||
* Main file that overlooks entire app routing
|
||||
*/
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
Platform,
|
||||
@@ -17,47 +14,23 @@ import {
|
||||
Stack
|
||||
} from 'react-native-router-flux';
|
||||
|
||||
const instructions = Platform.select({
|
||||
ios: 'Press Cmd+R to reload,\n' +
|
||||
'Cmd+D or shake for dev menu',
|
||||
android: 'Double tap R on your keyboard to reload,\n' +
|
||||
'Shake or press menu button for dev menu',
|
||||
});
|
||||
// Imported screens to route through
|
||||
import Home from './screens/home.js';
|
||||
import Loading from './screens/loading.js';
|
||||
|
||||
type Props = {};
|
||||
export default class App extends Component<Props> {
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.welcome}>
|
||||
Welcome to React !
|
||||
</Text>
|
||||
<Text style={styles.instructions}>
|
||||
To get started, edit App.js
|
||||
</Text>
|
||||
<Text style={styles.instructions}>
|
||||
{instructions}
|
||||
</Text>
|
||||
</View>
|
||||
<Router>
|
||||
<Stack key='root' style={{paddingTop: 54}}>
|
||||
<Scene key='home' component={Home} title="Home" hideNavBar={true} />
|
||||
<Scene key='loading' component={Loading} title='Loading' />
|
||||
{/*
|
||||
<Scene key='chat' component={Chat} title='Chat' hideNavBar={false} />
|
||||
*/}
|
||||
</Stack>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
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": {
|
||||
"react": "16.3.1",
|
||||
"react-native": "0.55.3"
|
||||
"react-native": "^0.55.3",
|
||||
"react-native-router-flux": "^4.0.0-beta.28"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-jest": "22.4.3",
|
||||
|
||||
Reference in New Issue
Block a user