forked from redacademy/beta-summer-2017
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added reset functionality on survey submit to prevent question storag…
…e on new survey
- Loading branch information
1 parent
4f17269
commit 4b6f2b4
Showing
3 changed files
with
43 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,50 @@ | ||
import React from 'react' | ||
import React, { Component } from 'react' | ||
import { Text, View } from 'react-native'; | ||
import { connect } from 'react-redux'; | ||
|
||
import { resetSurvey } from '../../redux/modules/actions/surveyActions'; | ||
import { styles } from './styles'; | ||
import SurveyButton from '../../components/SurveyButton'; | ||
import { returnToHome, returnToEvents, returnToSpeaker } from '../../navigation/navHelpers'; | ||
|
||
const SurveyCompleteContainer = () => { | ||
const buttons = [ | ||
{ text: "Home", action: returnToHome }, | ||
{ text: "Events", action: returnToEvents }, | ||
{ text: "Speaker's Page", action: returnToSpeaker } | ||
]; | ||
class SurveyCompleteContainer extends Component { | ||
|
||
return ( | ||
<View style={styles.sceneContainer}> | ||
<View style={styles.background}> | ||
<View style={styles.contentContainer}> | ||
<Text style={styles.title}>Thanks!</Text> | ||
<Text style={styles.text}>Your feedback has been submitted.</Text> | ||
{buttons.map(button => ( | ||
<SurveyButton | ||
key={button.text} | ||
text={button.text} | ||
onPress={() => button.action()} | ||
cStyle={styles.buttonContainer} | ||
/> | ||
))} | ||
static route = { | ||
navigationBar: { | ||
title: "Submit Complete", | ||
renderLeft: () => null | ||
} | ||
} | ||
|
||
componentDidMount() { | ||
this.props.dispatch(resetSurvey()); | ||
} | ||
|
||
render() { | ||
const buttons = [ | ||
{ text: "Home", action: returnToHome }, | ||
{ text: "Events", action: returnToEvents }, | ||
{ text: "Speaker's Page", action: returnToSpeaker } | ||
]; | ||
return ( | ||
<View style={styles.sceneContainer}> | ||
<View style={styles.background}> | ||
<View style={styles.contentContainer}> | ||
<Text style={styles.title}>Thanks!</Text> | ||
<Text style={styles.text}>Your feedback has been submitted.</Text> | ||
{buttons.map(button => ( | ||
<SurveyButton | ||
key={button.text} | ||
text={button.text} | ||
onPress={() => button.action()} | ||
cStyle={styles.buttonContainer} | ||
/> | ||
))} | ||
</View> | ||
</View> | ||
</View> | ||
</View> | ||
) | ||
} | ||
|
||
SurveyCompleteContainer.route = { | ||
navigationBar: { | ||
title: "Submit Complete", | ||
renderLeft: () => null | ||
) | ||
} | ||
} | ||
|
||
export default SurveyCompleteContainer; | ||
export default connect()(SurveyCompleteContainer); |