-1
constructor() {
super();
this.ref = firebase.firestore().collection('boards');
this.unsubscribe = null;
this.state = {
isLoading: true,
boards: []
};
componentDidMount() {
this.unsubscribe = this.ref.onSnapshot(this.onCollectionUpdate);
}
onCollectionUpdate = (querySnapshot) => {
const boards = [];
querySnapshot.forEach((doc) => {
const { title, description, author } = doc.data();
boards.push({
key: doc.id,
title,
description,
author
});
});
this.setState({
boards,
isLoading: false
})
console.log(boards);
}
return(
<View style={styles.container}>
{
this.state.boards.maps((item, i) => {
return (
<ListItem
key={i}
title={item.title}
leftIcon={{name: 'book', type: 'font-awesome'}}
onPress={() => {
this.props.navigation.navigate('BoardDetails', {
boardKey: `${JSON.stringify(item.key)}`,
});
}}
/>
);
})
}
</View>
);
The error is on the line: this.state.Boards.maps Where the error indicates that maps is not a function. I’m a beginner and I’m not able to find the mistake, I’ve made all kinds of trade, it may be silly, but I can’t find it! Could someone give me a light? I will be very grateful!