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

121
Views
React Native: Obteniendo "Error de profundidad de actualización máxima excedida"

Recibo un error de profundidad de actualización máxima excedida cuando intento iniciar la cuenta regresiva en mi aplicación React Native. Inicialmente, cuando paso una fecha encadenada a la variable "fecha de caducidad", funciona bien y mi temporizador de cuenta regresiva funciona bien. Sin embargo, estoy creando la aplicación para que obtenga una fecha y hora de entrega de firebase y necesito usar eso para pasar eso a la variable "fecha de vencimiento", para que el controlador pueda estar sincronizado con la cuenta regresiva de entrega. Cuando paso la fecha obtenida, es cuando recibo el error.

Aquí está el código cuando paso una fecha de cuerda normal 👇

 const start_timer = () => { setTimerStarted(true); var date = moment().format("YYYY-MM-DD hh:mm:ss"); //Getting the current date-time with required formate and UTC var expirydate = '2021-12-04 08:40:45'; //Let suppose we have to show the countdown for above date-time var diffr = moment.duration(moment(expirydate).diff(moment(date))); //difference of the expiry date-time given and current date-time var hours = parseInt(diffr.asHours()); var minutes = parseInt(diffr.minutes()); var seconds = parseInt(diffr.seconds()); var d = hours * 60 * 60 + minutes * 60 + seconds; //converting in seconds setTotalDuration(d); //Settign up the duration of countdown in seconds to re-render

};

Y aquí está mi código cuando pase la fecha de búsqueda 👇

 const start_timer = () => { setTimerStarted(true); var date = moment().format("YYYY-MM-DD hh:mm:ss"); //Getting the current date-time with required formate and UTC var expirydate = details.date; //Let suppose we have to show the countdown for above date-time var diffr = moment.duration(moment(expirydate).diff(moment(date))); //difference of the expiry date-time given and current date-time var hours = parseInt(diffr.asHours()); var minutes = parseInt(diffr.minutes()); var seconds = parseInt(diffr.seconds()); var d = hours * 60 * 60 + minutes * 60 + seconds; //converting in seconds setTotalDuration(d); //Settign up the duration of countdown in seconds to re-render

};

Y así es como estoy iniciando el temporizador 👇

 <TouchableOpacity onPress={() => start_timer()}> <> <LottieView style={{ alignSelf: "center", height: 40 }} source={require("../../../assets/animations/timer.json")} autoPlay={true} speed={2} loop={true} /> <Text style={{ color: "rgb(124, 90, 15)" }}>Start Timer</Text> </> </TouchableOpacity>

Mi instinto me dice que probablemente sea un problema con el momento 🤔. Simplemente no estoy seguro.

Solo para estar seguro, cuando consola.log(detalles.fecha), devuelve este formato de fecha "4 de diciembre de 2021 19:25 p. m."... Por eso no creo que sea un problema con la fecha obtenida, o yo 'No estoy seguro. ¿Alguna ayuda por favor?

about 4 years ago · Juan Pablo Isaza
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!