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

251
Views
ventana de reacción desplazarse hacia abajo

Estoy usando la ventana de reacción para generar una lista larga para mostrar mensajes. pero, ¿cómo puedo desplazarme hacia abajo para cada mensaje nuevo?

Podría manejarlo para Div normal usando useRef, pero ¿qué pasa con la ventana de reacción?

 const list = useRef<HTMLDivElement>(document.createElement('div')); useEffect(() => { list.current.scrollTop = list.current.scrollHeight; }, [message]);

y:

 <FixedSizeList width="100%" height={500} itemCount={messages.length} itemSize={40} itemData={messages} > {Row} </FixedSizeList>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Crearía una referencia para adjuntarla a FixedSizeList , luego crearía una función que se desplaza hasta el final de esa lista y tiene un efecto que escucha cuando se agrega un nuevo elemento a la lista. Algo como:

 function ListComponent({ messages }) { const listRef = useRef(null); const scrollToBottom = () => listRef?.current.scrollToItem(messages.length); useEffect(() => { scrollToBottom(); }, [messages]); return ( <FixedSizeList width="100%" height={500} itemCount={messages.length} itemSize={40} itemData={messages} ref={listRef} > {Row} </FixedSizeList> ); }
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!