I am currently working on an app and I just started on the search filter but it is throwing the following error:
Function Query.where() called with invalid data. Unsupported field value: a custom U object
and this is the code to the search screen
import React, { useState } from 'react';
import { View, Text, TextInput, FlatList } from 'react-native';
import firebase from 'firebase';
export default function Search() {
const [patients, setPatients] = useState([]);
const fetchPatients = (searchTxt) => {
firebase
.firestore()
.collection('Patients')
.where('doctorEmail', '==', firebase.auth().currentUser.email)
.where('patientName', '>=', searchTxt)
.get()
.then((snapshot) => {
let patients = snapshot.docs.map(doc => {
var data = doc.data()
var id = doc.id
return {id,...data}
})
setPatients(patients)
})
};
return (
<View>
<TextInput
placeholder="Search..."
style={{padding:100,marginTop:100}}
onChange={(searchTxt) => {fetchPatients(searchTxt)
console.log(patients)}}
/>
</View>
);
}
This is my database structure
if you have any idea on how to fix this issue please let me know...Any help would be appreciated