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

96
Views
React Native deja de ejecutarse

Tengo el siguiente código

 <DocumentPicker onDone={(res: DocumentPickerResponse[]) => { if (res.hasOwnProperty('isCancel')) { } else { handleDocumentPicker(res); handleAttachmentResizing(); } toggleDocumentPicker(); }}

DocumentPicker permite al usuario elegir un video de su galería, una vez que elige el identificador de video handleDocumentPicker obtiene la matriz de resultados y establece el estado de mi matriz de attachments . A continuación, se llama a handleAttachmentResizing para cambiar el tamaño de todos los archivos adjuntos de video en mi estado de attachments .

Así es como se ve el handleAttachmentResizing

 const handleAttachmentResizing = async () => { console.log('handleAttachmentResizing called'); try { console.log('handleAttachmentResizing called try'); lodash.forEach(newAttachments, async (item, idx) => { console.log('handleAttachmentResizing called try lodash'); console.log('handleAttachmentResizing loop ', idx); if (!item.isCompressed && !item.isCompressing && isVideo(item.type)) { const resizedVideo = await resizeVideo(item, idx); if (resizedVideo) { const uri = await moveFile(resizedVideo); const update: Attachment = { ...item, isCompressed: true, isCompressing: false, uri, }; updateAttachment(item.uri, update); } } }); } catch (err) { console.error('handleAttachmentResizing ', err); } console.log('handleAttachmentResizing called');

};

Y resizeVideo se ve así

 const resizeVideo = async (attachment: Attachment, idx: number) => { console.log('resizeVideo called'); try { return await Video.compress( attachment.uri, { compressionMethod: 'auto', getCancellationId: (cancellationId) => setVideoCancellationToken(cancellationId), }, (progress) => { if(mounted.current){ const updated: Attachment = { ...attachment, progress, isCompressing: true, }; updateAttachment(attachment.uri, updated); }else { //Video.cancelCompression() handleRemoveAttachment(attachment, idx); } }, ); } catch (err) { console.error('resizeVideo ', err); handleRemoveAttachment(attachment, idx); } };

No estoy seguro de por qué, pero handleAttachmentResizing solo imprime handleAttachmentResizing called try y termina allí, si elijo otro archivo en mi galería, misteriosamente continúa ejecutándose.

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!