1deleting whole flatlist in one go using firestore
2
3filter data=(_item)=>{
4 this.setState({users: this.state.users.filter(item => item. Key=== _item)});
5 console.log(this.state.favorites) }
6call this function in button deleteall code given below
7 <Touchable Opacity
8 onPress={() => { async function massDeleteUsers() {
9 // Get all users
10 const usersQuerySnapshot = await firestore().collection('user').get(
11 );
12 // Create a new batch instance
13 const batch = firestore().batch();
14 usersQuerySnapshot.forEach(documentSnapshot => {
15 batch.delete(documentSnapshot.ref); });
16 return batch.commit();}
17 massDeleteUsers().then(() =>{
18 this.filterdata()
19 console.log('All users deleted in a single batch operation.')}) }}>
20so this will delete whole flatlist in on go and delete whole firestore collection