-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added functionality to edit volunteer emails, added volunteer email s…
…aving to AsyncStorage
- Loading branch information
1 parent
71b139c
commit d742656
Showing
11 changed files
with
224 additions
and
38 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
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React, { Component } from 'react'; | ||
import { | ||
AppRegistry, | ||
StyleSheet, | ||
Text, | ||
View, | ||
Platform, | ||
TouchableOpacity, | ||
Linking, | ||
Button, | ||
AsyncStorage, | ||
Image, | ||
TextInput | ||
} from 'react-native'; | ||
import Toast from 'react-native-simple-toast' | ||
import {NavigationActions} from 'react-navigation' | ||
|
||
export class Settings extends Component { | ||
static navigationOptions = { | ||
title: 'Settings', | ||
mode: 'modal' | ||
}; | ||
constructor(props){ | ||
super(props) | ||
this.state = { | ||
text: '' | ||
} | ||
this.saveEmail = this.saveEmail.bind(this) | ||
} | ||
|
||
saveEmail(){ | ||
AsyncStorage.setItem("volunteer", this.state.text) | ||
Toast.show("Email successfully edited.") | ||
this.props.navigation.dispatch(NavigationActions.back()) | ||
} | ||
componentWillMount(){ | ||
AsyncStorage.getItem("volunteer").then(function(value){ | ||
console.log(value) | ||
if(!(value === null)){ | ||
this.setState({text: value}) | ||
} | ||
}.bind(this)) | ||
} | ||
|
||
render() { | ||
return ( | ||
<View style = {styles.container}> | ||
<Text style={styles.welcome}> | ||
Volunteer Email | ||
</Text> | ||
<TextInput | ||
style={{height: 40, width:300}} | ||
onChangeText={(text) => this.setState({text})} | ||
value={this.state.text} | ||
/> | ||
<Button onPress={this.saveEmail} title="Next"></Button> | ||
</View> | ||
) | ||
} | ||
} | ||
|
||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 3, | ||
justifyContent: 'flex-start', | ||
alignItems: 'center', | ||
backgroundColor: '#F5FCFF', | ||
}, | ||
welcome: { | ||
marginTop: 50, | ||
fontSize: 25, | ||
marginBottom: 10, | ||
}, | ||
instructions: { | ||
textAlign: 'center', | ||
color: '#333333', | ||
marginBottom: 5, | ||
}, | ||
}); |
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
Oops, something went wrong.