-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Feature] 액션시트 컴포넌트 구현 #165
base: main
Are you sure you want to change the base?
Conversation
ab9e60c
to
d45ec4a
Compare
|
Size Change: +21.4 kB (+3.15%) Total Size: 702 kB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨어요~~
저도 children 의 타입을 강제할 수 있는 방법은 없나,, 찾아봤는데 언급 주신 이슈 처럼 아직 해결되진 않은 거 같더라구요.
대안책으로는..
컴파일 타임에서 children 타입을 지정하는 건 어려울 거 같지만 런타임에서는 children 을 순회하면서 특정 타입의 컴포넌트 인지 아닌 지 판단할 수 있지 않을까...🤔 라는 생각이 드네요.
Children.forEach(children, (child) => {
if (typeof child === 'Element' && child?.type === 'ActionSheetHeader') {
...
}
packages/wow-ui/src/components/ActionSheet/ActionSheetHeader.tsx
Outdated
Show resolved
Hide resolved
packages/wow-ui/src/components/ActionSheet/ActionSheetOverlay.tsx
Outdated
Show resolved
Hide resolved
1798202
to
647819c
Compare
🎉 변경 사항
액션시트 컴포넌트를 구현합니다.
🚩 관련 이슈
🙏 여기는 꼭 봐주세요!
1-1. 문제상황
ReactElement
타입이면서, 원하는 컴포넌트의 타입을 제네릭으로 받으면prop
타입을 제한할 수 있으니children
의 형식과 타입을 제한할 수 있다고 생각했습니다.ReactElement
중에서도ActionSheetHeader
에서 정의한prop
을 받아야 만족하는 것으로 예상했습니다.ReactElement
로children
개수만 맞추면 타입체킹에서 걸리지 않았습니다…1-2. 해결방법으로 알아봤던 것들
-> 결국 안된다는 것 같은데, 혹시 다른 아이디어가 있으시면 리뷰 부탁드립니다..
2-1. 패키지 버전업 & 탭 컴포넌트