From 41ae967e0a458d9728e76401bd08385dd03b3c74 Mon Sep 17 00:00:00 2001 From: Kumar Damani Date: Tue, 5 Mar 2019 19:25:49 -0500 Subject: added ui package, edited text on greeting page, using new ui package in form page --- mobile/screens/Form1.js | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'mobile/screens/Form1.js') diff --git a/mobile/screens/Form1.js b/mobile/screens/Form1.js index 963bde2..16ced64 100644 --- a/mobile/screens/Form1.js +++ b/mobile/screens/Form1.js @@ -1,12 +1,12 @@ import React, { Component } from 'react'; -import {Text, Alert, AppRegistry, Button, StyleSheet, View, TextInput } from 'react-native'; +import {Text, Alert, AppRegistry, StyleSheet, View } from 'react-native'; +import { Button, Input, CheckBox } from 'react-native-elements'; export default class Form1 extends Component { _onPressButton1() { const { navigation } = this.props; const coordinates = navigation.getParam('coordinates'); //var coordinates = this.coordinates ? coordinates : []; - Alert.alert("Thank you for your response."); fetch('https://helpthehome-qa.herokuapp.com/mobilerequest', { method: 'POST', headers: { @@ -15,13 +15,18 @@ export default class Form1 extends Component { }, body: JSON.stringify({ 'coordinates': coordinates, - 'type': "Point", - 'isInjured': this.state.injured, - 'reasonForHelp': this.state.why, - 'ageRange': this.state.age, + 'type': "Point", + 'isInjured': this.state.injured, + 'reasonForHelp': this.state.why, + 'ageRange': this.state.age, 'clothingDescription': this.state.appearance }), }); + // TODO: handle the response from the serve and decide what to display + // based on that + // for now just to back to the home page + Alert.alert("You will now be redirected to the main page"); + this.props.navigation.navigate('GreetingPage'); } _onPressButton2() { Alert.alert('Continue:') @@ -31,7 +36,7 @@ export default class Form1 extends Component { this.state = { age: '', appearance: '', - injured: false, + injured: false, why: '' }; } @@ -40,37 +45,37 @@ export default class Form1 extends Component { return ( Age: - this.setState({age:text})} + placeholder="Estimate is fine" + onChangeText={(age) => this.setState({age})} /> Appearance: - this.setState({appearance})} /> - Are they injured? - this.setState({injured})} + this.setState({ injured: !this.state.injured })} /> Reason for help? - this.setState({why})} />