I am trying to save the data in the firebase real-time database using the set()
method. I can save the name of food and id successfully. But unable to save the images. Meantime I have to retrieve the saved data into the flat list. Can you pls help me to save the image data in firebase in realtime?
Here is the button with onPress()
for passing parameters to the addtofavorites()
<TouchableOpacity
onPress={() =>
addToFavourites(item.menuId, item.name, item.photo)
}>
Here is the database method
//Database
const addToFavourites = async (id, foodname, image) => {
//get current user
var user = await auth().currentUser.uid;
//get Unique key
var databaseRef = await database().ref(user).child('favourites').push();
//update the details
databaseRef.set({
menuId: id,
name: foodname,
image: image,
});
};