Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. export default class atualizaranuncio extends Component {
  2.  
  3. constructor() {
  4. super();
  5. this.state = {
  6. status: '',
  7. titulo: [],
  8. titulo_selecionado: ""
  9. };
  10. firebase.auth().onAuthStateChanged((user) => {
  11. if (user) {
  12. firebase.database().ref('Tarefas').child(user.uid).once('value', (snapshot) => {
  13. let state = this.state;
  14. state.titulo = [];
  15.  
  16. snapshot.forEach((childItem) => {
  17. state.titulo.push({
  18. key: childItem.key,
  19. titulo: childItem.val().titulo
  20. });
  21. });
  22. this.setState(state);
  23. });
  24. }
  25. });
  26. }
  27.  
  28. render() {
  29. return (
  30. <View style={styles.container}>
  31.  
  32. <Text style={styles.logoText}>Atualizar o Anuncio</Text>
  33. <Text>{'n'}</Text>
  34. <Text style={styles.texto}>Titulo do Anuncio:</Text>
  35. <Picker
  36. selectedValue={this.state.titulo_selecionado}
  37. style={styles.picker}
  38. onValueChange={(itemValue, itemIndex) => this.setState({ titulo_selecionado: itemValue })}>
  39. {this.state.titulo.map((item, index) => {
  40. return (
  41. <Picker.Item label={item.titulo} value={item.titulo} key={index}/>
  42. );
  43. })}
  44. </Picker>
  45. <Text style={styles.texto}>Descrição do Anuncio:</Text>
  46. <TextInput style={styles.inputBox}
  47. underlineColorAndroid='rgba(0,0,0,0)'
  48. placeholder="Descrição"
  49. placeholderTextColor="#ffffff"
  50. selectionColor="#fff"
  51. />
  52. <Text style={styles.texto}>Valor do Anuncio:</Text>
  53. <TextInput style={styles.inputBox}
  54. underlineColorAndroid='rgba(0,0,0,0)'
  55. placeholder="R$0000,00"
  56. placeholderTextColor="#ffffff"
  57. selectionColor="#fff"
  58. keyboardType="number-pad"
  59. />
  60. <Text style={styles.texto}>Status:</Text>
  61. <Picker
  62. selectedValue={this.state.status}
  63. style={styles.picker}
  64. onValueChange={(itemValue, itemIndex) =>
  65. this.setState({ status: itemValue })
  66. }>
  67. <Picker.Item label="Não realizado" value="1" />
  68. <Picker.Item label="Realizado" value="0" />
  69. </Picker>
  70. <TouchableOpacity style={styles.button}>
  71. <Text style={styles.buttonText}>Atualizar Anuncio</Text>
  72. </TouchableOpacity>
  73.  
  74. </View>
  75. );
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement