Skip to content

Commit

Permalink
fix: sticky header not position in the right place
Browse files Browse the repository at this point in the history
  • Loading branch information
r0b0t3d committed Aug 1, 2023
1 parent 9cdb8ff commit 7c1aed0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/CollapsibleView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default function CollapsibleView({
useAnimatedReaction(
() => (collapseState.value === 0 ? 0 : collapseState.value === 1 ? 1 : 0),
(result, prev) => {
if (result === prev) {
if (prev === null || result === prev) {
return;
}
if (onToggle) {
Expand Down Expand Up @@ -158,7 +158,7 @@ export function CollapsibleHeaderText({
iconInitialAngle = 0,
children,
}: {
title: string | Element;
title: string | ReactNode;
style?: StyleProp<ViewStyle>;
titleStyle?: StyleProp<TextStyle>;
icon?: ReactNode;
Expand Down
4 changes: 3 additions & 1 deletion src/components/header/CollapsibleHeaderContainerProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export default function CollapsibleHeaderContainerProvider({
if (!currentLayout.value) {
return -1;
}
return currentLayout.value.height - stickyHeight.value;
return (
currentLayout.value.height - currentLayout.value.y - stickyHeight.value
);
},
(result, previous) => {
if (result !== -1 && result !== previous) {
Expand Down
5 changes: 0 additions & 5 deletions src/withCollapsibleContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ export default function withCollapsibleContext<T>(Component: FC<T>) {
acc += layout?.stickyHeight ?? 0;
return acc;
}, 0);
console.log({
top,
stickyHeightAbove,
});
//
collapsibleHandlers.current?.scrollTo(
top - stickyHeightAbove,
animated
Expand Down

0 comments on commit 7c1aed0

Please sign in to comment.