Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

243
Views
¿Cómo actualizo el campo en mi artículo en la base de datos en tiempo real?

Estoy tratando de actualizar un campo en mi nodo de base de datos en tiempo real. Actualmente está funcionando, pero recibo errores después de hacer clic en el botón, incluso el valor en la base de datos cambia. Básicamente cambiando favorite: true o favorite:false

Estos son los 2 errores que recibo cuando se presiona el botón.

@firebase/database: ADVERTENCIA DE FIREBASE: la devolución de llamada del usuario lanzó una excepción. onValue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.familyrecipebook&modulesOnly=false&runModule=true:149302:35

TypeError: this.snapshotCallback.call no es una función. (En 'this.snapshotCallback.call(null, expDataSnapshot, previousChildName)', 'this.snapshotCallback.call' no está definido)

Este es mi código actual para actualizar el valor.

 const markOrRemoveFavorite = () => { const recipeRef = ref(db, 'users/' + userId + '/recepies' + `/${item.id}`) // const recipeData = { // favorite: item.favorite ? false : true // } // const newRecipeKey = push(child(ref(db), 'users/' + userId + '/recepies' + `/${item.id}`)).key // const updates = {}; // updates[newRecipeKey] = recipeData; return update(recipeRef, {favorite: item.favorite ? false : true}) }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Resolví el problema siguiendo. Pero el texto del botón no cambia aún en tiempo real.

 const recipeRef = ref(db, 'users/' + userId + '/recepies' + `/${item.id}`) const recipeData = { favorite: item.favorite ? false : true } update(recipeRef, recipeData).then(() => { if (item.favorite === false) { Toast.show({ type: 'success', position: 'bottom', text1: 'Recipe', text2: `Recipe ${item.recipe} was added to favorites`, }) } else { Toast.show({ type: 'success', position: 'bottom', text1: 'Recipe', text2: `Recipe ${item.recipe} was removed from favorites`, }) } })
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!