Git Product home page Git Product logo

Comments (3)

alittlekitten avatar alittlekitten commented on June 15, 2024

Honeycam 2022-04-10 04-31-52
image

ref를 적용하고, 스크롤이 위치한 곳의 DOM 요소를 넣어둔 후에 scrollTop을 scrollHeight로 설정함으로써 구현 완료

from ssocotimer.

alittlekitten avatar alittlekitten commented on June 15, 2024

image
image

기존 로직의 경우 lap이 추가됨과 동시에 scroll을 아래로 내려줬기 때문에 추가 이전에 스크롤의 위치를 계산해서 새로운 요소가 안보이는 문제가 발생했습니다.

그래서 해당 로직을 담은 부분을 별도의 downScroll 함수로 빼고, useEffect를 이용해서 lap이 변화가 되어서 리렌더링이 된 이후에 scroll 계산을 하는 방식으로 교체하여 문제를 해결했습니다.

from ssocotimer.

alittlekitten avatar alittlekitten commented on June 15, 2024

새로운 요소가 추가될 때만 해당 useEffect가 작동하기 때문에, 다른 탭(스톱워치, 타이머, 시계)로 이동했다가 돌아오는 경우 맨 위 요소가 보이게 됩니다.

from ssocotimer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.