Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/react-pdf-initial-page-width.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@naverpay/react-pdf': patch
---

[react-pdf] 첫 렌더 시 컨테이너 대신 window 폭으로 페이지 폭이 계산되어 컨테이너보다 넓게 그려지는 문제 수정
4 changes: 3 additions & 1 deletion packages/react-pdf/src/components/PdfViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ export function PdfViewer({
)

if (!pdf || !width) {
return null
/* 첫 렌더에서도 컨테이너 폭을 측정할 수 있도록 높이 0인 div에 ref를 연결한다.
* ref가 없으면 window.innerWidth로 계산되어 컨테이너보다 넓게 그려진다. */
return <div ref={ref} style={style} />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

className={cx('article')} 까지 포함될 필요는 없을까요?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

네네 괜찮을 것 같습니다! 기존 동작이 null 이였어서 article 넣으면 min-height : 100% 때문에 로딩중에 회색 부분 보일 것 같습니다..!

}

return (
Expand Down
Loading