0
I’m trying to popular this Picker with BD data (for when the person wants to delete, she choose by title), but it n fills in, and I don’t know if I’m doing it right. thanks for the help! :)
export default class delanuncio extends Component {
constructor() {
super();
this.state = {
titulo:[]
};
firebase.auth().onAuthStateChanged((user)=>{
if(user){
firebase.database().ref('Tarefas').child(user.uid).once('value', (snapshot)=>{
let state = this.state;
state.titulo =[];
snapshot.forEach((childItem)=>{
state.titulo.push({
key: childItem.key,
titulo:childItem.val().titulo
});
});
this.setState(state);
});
}
});
}
render() {
return (
<View style={styles.container}>
<Text style={styles.logoText}>Deletar Anuncio</Text>
<Text>{'\n'}</Text>
<Text style={styles.texto}>Titulo do Anuncio:</Text>
<Picker
selectedValue={this.state.titulo}
style={styles.picker}
onValueChange={({itemValue}, itemIndex) => <Picker.Item key={titulo} label={titulo} value={titulo} />
}>
</Picker>
<TouchableOpacity style={styles.button}>
<Text style={styles.buttonText}>Deletar Anuncio</Text>
</TouchableOpacity>
</View>
);
}
}
Thank you very much friend! ;)
– Nuck