Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ› ๏ธ Profile Page Scroll ์ด์Šˆ ์ˆ˜์ • #84

Merged
merged 4 commits into from
May 29, 2024

Conversation

Legitgoons
Copy link
Member

@Legitgoons Legitgoons commented May 29, 2024

์ž‘์—… ์ด์œ 

#81 ์ด์Šˆ ํ•ด๊ฒฐ


์ž‘์—… ์‚ฌํ•ญ

1๏ธโƒฃ RootLayout.tsx์— ScrollRestoration ์ถ”๊ฐ€

  • ์ƒˆ ํ™”๋ฉด์œผ๋กœ ์ด๋™ํ• ๋•Œ๋Š” ์Šคํฌ๋กค์„ ์ตœ์ƒ๋‹จ์œผ๋กœ ์ด๋™์‹œํ‚ค๊ณ , ๊ธฐ์กด ํ™”๋ฉด์œผ๋กœ ๋Œ์•„๊ฐˆ๋•Œ๋Š”location.pathname ์†์„ฑ์„ ํ™œ์šฉํ•ด scroll์ด ๊ทธ๋Œ€๋กœ ์œ ์ง€๋˜๊ฒŒ ์„ค์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
<ScrollRestoration
  getKey={(location) => {
    return location.pathname;
  }}
/>

2๏ธโƒฃ FeedMainPage ์–ธ๋งˆ์šดํŠธ ์‹œ Kebab๋ฉ”๋‰ด ๋‹ซํž˜

  • useFeedKebabStore๋ฅผ export ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • FeedMainPage๊ฐ€ ์–ธ๋งˆ์šดํŠธ ๋  ๋•Œ, useEffect์˜ ํด๋ฆฐ์—… ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•ด kebab๋ฉ”๋‰ด๊ฐ€ ๋‹ซ๊ธฐ๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋ฆฌ๋ทฐ์–ด๊ฐ€ ์ค‘์ ์ ์œผ๋กœ ํ™•์ธํ•ด์•ผ ํ•˜๋Š” ๋ถ€๋ถ„

  • Profile Page์˜ ๊ฒฝ์šฐ, ์Šคํฌ๋กค์ด ์ตœ์ƒ๋‹จ์—์„œ ๋žœ๋”๋ง๋˜๋Š”์ง€
  • Main Page์˜ ๊ฒฝ์šฐ, ๊ธฐ์กด ์œ„์น˜์—์„œ ๋žœ๋”๋ง๋˜๋Š”์ง€

๋ฐœ๊ฒฌํ•œ ์ด์Šˆ

๋‹ค๋งŒ, iPhoneLayout์˜ ๊ฒฝ์šฐ์—๋Š” ์—ฌ์ „ํžˆ ์Šคํฌ๋กค์ด ์ •์ƒ์ ์œผ๋กœ ์ด๋™๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด ๋ถ€๋ถ„์€ package์˜ ๋ฌธ์ œ๋ผ๊ณ  ์ƒ๊ฐ๋˜์–ด react-iphone-layout package์— issue๋กœ ๋“ฑ๋กํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

router/index.ts์— ScrollRestoration๋ฅผ ์ถ”๊ฐ€ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-84.d37mn03xh3qyyz.amplifyapp.com

Copy link
Collaborator

@BangDori BangDori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด์Šˆ ์ธ์ง€ํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทผ๋ฐ, ๋ฌธ์ œ์ ์ด ํ•˜๋‚˜ ์žˆ์Šต๋‹ˆ๋‹ค.

image

์œ„ ์ด๋ฏธ์ง€์ฒ˜๋Ÿผ ํ† ๊ธ€๋ฐ”๋ฅผ ์—ฐ ์ƒํƒœ๋กœ ํ”„๋กœํ•„ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•˜๊ณ  ๋Œ์•„์˜ค๋ฉด, ํ† ๊ธ€ ๋ฐ”๊ฐ€ ๋‹ซ๊ฒจ์žˆ์–ด์•ผ ํ•˜๋Š”๋ฐ ์—ด๋ ค์žˆ์Šต๋‹ˆ๋‹ค.

useEffect์˜ ํด๋ฆฐ์—… ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•ด, FeedMainPage๊ฐ€ ์–ธ๋งˆ์šดํŠธ ๋  ์‹œ kebab๋ฉ”๋‰ด๊ฐ€ ๋‹ซํžˆ๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.
@Legitgoons Legitgoons force-pushed the fix/profile-scroll-bug branch from 9106c73 to 0a633c3 Compare May 29, 2024 13:20
Copy link
Collaborator

@BangDori BangDori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํด๋ฆฐ์—… ํ•จ์ˆ˜ ๊น”๋”ํ•˜๋„ค์š” ใ…‹ใ…‹ใ…‹ ๐Ÿ‘

@Legitgoons Legitgoons merged commit 1975ccc into main May 29, 2024
2 checks passed
@BangDori BangDori deleted the fix/profile-scroll-bug branch May 29, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants