From 08ace56f4496fb5d2027050d77265f19749e8af4 Mon Sep 17 00:00:00 2001 From: Donald Joy Date: Mon, 29 Jan 2018 15:14:32 -0500 Subject: [PATCH] reset form button --- modules/main/components/CheckBox/CheckBox.js | 8 ++--- .../DecisionSection/DecisionSection.js | 34 ++++++------------- modules/main/components/Picker/Picker.js | 15 ++++---- modules/main/scenes/Form.js | 1 - 4 files changed, 21 insertions(+), 37 deletions(-) diff --git a/modules/main/components/CheckBox/CheckBox.js b/modules/main/components/CheckBox/CheckBox.js index 7690ee3..1bc3868 100644 --- a/modules/main/components/CheckBox/CheckBox.js +++ b/modules/main/components/CheckBox/CheckBox.js @@ -74,7 +74,7 @@ export default class Checkbox extends PureComponent { ) } - handleToggleChecked = () => { + handleToggleChecked = () => { const { label } = this.props const categoryArr = this.props.categoryArr const checked = this.state.checked; @@ -89,7 +89,6 @@ export default class Checkbox extends PureComponent { const catArr = this.state.categories const categories = categoryArr[i]; this.setState({categories}) - console.log(this.state, 'line 101 checkbox') } }); @@ -97,12 +96,11 @@ export default class Checkbox extends PureComponent { } else if (checked===true) { - let categories = this.state.categories; + let categories = this.state.categories; this.setState({categories: categories.label}); this.setState({ checked: false}); - this.setState({label: ''}) + this.setState({label: ''}) return this.state - console.log(this.state, 'line 125 checkbox') } } } diff --git a/modules/main/components/DecisionSection/DecisionSection.js b/modules/main/components/DecisionSection/DecisionSection.js index f08123e..caa5eca 100644 --- a/modules/main/components/DecisionSection/DecisionSection.js +++ b/modules/main/components/DecisionSection/DecisionSection.js @@ -25,7 +25,7 @@ export default class DecisionSection extends Component{ // this.setState({counter: this.props.counter}); // console.log(this.props.counter); // } - + componentDidMount(){ this.handleRandomizeButton() // const counter = this.props.counter @@ -41,18 +41,9 @@ export default class DecisionSection extends Component{ } - handleSwipeRight(){ - Alert.alert( - "You are Buridian's Ass!!!", - 'Pay $1,000,000 to unlock feature', - [ - {text: 'I am sorry', onPress: () => console.log('Ask me later pressed')}, - {text: 'I Know', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, - // {text: 'OK', onPress: () => console.log('OK Pressed')}, - ], - { cancelable: false } - ) - // alert("You are Buridian's Ass\n Pay $1,000,000") + handleSwipeRight = () => { + Alert.alert("Enjoy your meal"); + Linking.openURL(this.state.fourSquarePage).catch(err => console.error('An error occurred', err)); } @@ -63,7 +54,7 @@ export default class DecisionSection extends Component{ }) console.log(categories, 'map category') - if(counter > 0){ + if(counter > 0){ // console.log(this.props.categoryObj[0].categoryID, this.props.location) API.getRestaurant(categories.join(), this.props.location) .then((response)=> response.json()) @@ -87,17 +78,12 @@ export default class DecisionSection extends Component{ this.handlePhoto(); }) - - // console.log('line 68 ===================', this.state, 'end ==========') - // console.log(this.props); - // alert('fuck dude') - // let counter = this.state.counter - // this.setState({counter: counter --}); + counter -- } else{ Alert.alert( - "Go on Yelp", + "Just go to Yelp", "You're defeating the purpose of the App!", [ // {text: 'I am sorry', onPress: () => console.log('Ask me later pressed')}, @@ -122,7 +108,7 @@ export default class DecisionSection extends Component{ // console.log("responseJson: " + responseJson.response.photos.items[0]); const photoObject = responseJson.response.photos.items[0]; let imageUrl = photoObject.prefix + '300x500' + photoObject.suffix; - + // responseJson.response.photos.items[0] ? this.setState({imageUrl}) : this.setState({imageUrl: 'http://lorempicsum.com/futurama/350/200/1'}) this.setState({imageUrl: imageUrl === '' || imageUrl === this.state.imageUrl || imageUrl===undefined ? 'http://lorempicsum.com/futurama/350/200/1' : imageUrl}) }) @@ -147,9 +133,9 @@ export default class DecisionSection extends Component{ { - Actions.Main(); + this.setState({location: ""}); + this.setState({numOptions: 1 }); + this.setState({counter: 1}); + Actions.refresh(); } handleFormSubmit = event => { event.preventDefault(); console.log("Submit button pressed"); console.log(this.state.numOptions); - // console.log(this.state.numOptions); - // console.log(this.state.location); + if(this.state.location.trim() === ''){ alert('Location is a required field') } @@ -137,8 +140,6 @@ export default class PickerExample extends Component { }); } - // this.props.API('4bf58dd8d48988d10f941735', 'Fairfax') - }; onAddCategory = obj =>{ @@ -239,12 +240,12 @@ export default class PickerExample extends Component { Submit - {/**/} + diff --git a/modules/main/scenes/Form.js b/modules/main/scenes/Form.js index 9548db8..212b50c 100644 --- a/modules/main/scenes/Form.js +++ b/modules/main/scenes/Form.js @@ -27,7 +27,6 @@ class Home extends React.Component { restaurantId: '', fourSquarePage: "", numOptions: "", - asian: false } componentDidMount(){