aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mobile/components/GreetingPage.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/mobile/components/GreetingPage.js b/mobile/components/GreetingPage.js
index 035ee41..88c3de3 100644
--- a/mobile/components/GreetingPage.js
+++ b/mobile/components/GreetingPage.js
@@ -14,10 +14,10 @@ export default class GreetingPage extends Component {
// runs as soon as page is loaded
componentDidMount() {
// immediately attempt to get the location
- this._getLocationAsync();
+ // this._getLocationAsync();
}
- _getLocationAsync = async () => {
+ moveToFormPage = async () => {
// ask location services to allow location access to THIS app.
// Note: location services itself must still be enabled for this!
const {status} = await Permissions.askAsync(Permissions.LOCATION);
@@ -27,6 +27,12 @@ export default class GreetingPage extends Component {
this.setState({locationResult: position.coords});
// since we are guaranteed to have the location here, its safe to load the full view
this.setState({isLoading: false});
+ // move to form page
+ this.props.navigation.navigate('FormPage',
+ {coordinates : [
+ this.state.locationResult.longitude,
+ this.state.locationResult.latitude]
+ });
}).catch((e) => {
alert(e + ' Please make sure your location (GPS) is turned on.');
});
@@ -81,7 +87,7 @@ export default class GreetingPage extends Component {
<TouchableHighlight
style={styles.first_button_container}
- onPress={() => { this.moveToFormPage() }}>
+ onPress={() => { this.moveToFormPage(); }}>
<View style={styles.press_button}>