9월, 2024의 게시물 표시

스티키 헤더 여러개 만들기 (Multiple sticky header)

# 스티키 헤더 여러개 만들기 ScrollView 에서 제공하는 stickyHeader 를 사용하려면 단순히 [stickyHeaderIndices](https://reactnative.dev/docs/scrollview#stickyheaderindices) 에 스티키 헤더가 될 인덱스를 넣으면 된다. 하지만 인덱스 여러개를 넣게되면 인덱스에 포함되는 행들이 차례로 쌓이는게 아니라 두번 째 행이 위에 붙게되면 원래 붙어있었던 첫번 째 행은 위로 올라가 사라지고 만다. 나는 여러개의 행이 차례로 쌓이는 이른바 multiple sticky header 를 만드는 방법에 대해 내가 고민했던 방법을 정리하고자 한다. There is [stickyHeaderIndices](https://reactnative.dev/docs/scrollview#stickyheaderindices) option in ScrollView if you need simple sticky header. However, i need multiple sticky headers that stack upon each other. Usually when a user scrolls up, the previous sticky header is replaced by the new one. 기본적인 원리는 스크롤 뷰 위에 스티키 헤더를 absolute 로 겹쳐놓고 스크롤의 y 좌표가 해당 헤더 위치를 지나가면 겹쳐놓은 스티키 헤더의 display 를 none 에서 flex 로 변경해주는 것이다. Basic idea is overlapping invisible header over scrollView and when the header moving up touching top of the view, make the invisible header visible. ```js <SafeAreaView> <View> <ScrollView onScroll={handl

스티키 헤더 여러개 만들기 (Multiple sticky header)

# 스티키 헤더 여러개 만들기 ScrollView 에서 제공하는 stickyHeader 를 사용하려면 단순히 [stickyHeaderIndices](https://reactnative.dev/docs/scrollview#stickyheaderindices) 에 스티키 헤더가 될 인덱스를 넣으면 된다. 하지만 인덱스 여러개를 넣게되면 인덱스에 포함되는 행들이 차례로 쌓이는게 아니라 두번 째 행이 위에 붙게되면 원래 붙어있었던 첫번 째 행은 위로 올라가 사라지고 만다. 나는 여러개의 행이 차례로 쌓이는 이른바 multiple sticky header 를 만드는 방법에 대해 내가 고민했던 방법을 정리하고자 한다. There is [stickyHeaderIndices](https://reactnative.dev/docs/scrollview#stickyheaderindices) option in ScrollView if you need simple sticky header. However, i need multiple sticky headers that stack upon each other. Usually when a user scrolls up, the previous sticky header is replaced by the new one. 기본적인 원리는 스크롤 뷰 위에 스티키 헤더를 absolute 로 겹쳐놓고 스크롤의 y 좌표가 해당 헤더 위치를 지나가면 겹쳐놓은 스티키 헤더의 display 를 none 에서 flex 로 변경해주는 것이다. Basic idea is overlapping invisible header over scrollView and when the header moving up touching top of the view, make the invisible header visible. ```js <SafeAreaView> <View> <ScrollView onScroll={handl

이 블로그의 인기 게시물

Operating System Concept

Operating System Concepts 9th

카카오 내비 리엑트 네이티브 모듈 만들기 ft.코틀린