Hi All, I am trying to add queries to firebase by a loop.
I am using this code
for ( var i=0; i< listView2.data.length; i++){
var textInputValues = listView2.data[i].textInput1;
const data = {
SpecialReq: textInputValues,
}
await db.firestore().collection('Ticket').doc().set(data);
}
but the error is coming out
TypeError: Cannot read properties of undefined (reading 'textInput1')
* * message:"TypeError: Cannot read properties of undefined (reading 'textInput1')"
I try to use it as
var textInputValues = listView2.data['0'].textInput1;
and the first item can be added to the database.
May I have any solution? thanks