import * as React from 'react'; import type { ScopedCollapsingHeaderProps } from './ScopedCollapsingHeader'; export type { ScopedCollapsingHeaderProps } from './ScopedCollapsingHeader'; /** * Web counterpart of the native scoped Contacts-style header. Same props and * the same look: a soft vertical gradient hero (avatar/name/actions) that * scrolls away, and an always-on translucent compact bar that keeps the list * blurred beneath it via CSS `backdrop-filter: blur()` — the web equivalent of * the native `UIBlurEffect`. Confined to its own column, so the color never * bleeds across a sibling master column. */ export default function ScopedCollapsingHeader({ title, gradientColors, tintColor = '#FFFFFF', compactTitleColor, expandedHeight = 240, collapsedHeight = 48, topInset = 0, renderHero, headerLeft, children, contentContainerStyle, }: ScopedCollapsingHeaderProps) { const [scrollTop, setScrollTop] = React.useState(0); const heroHeight = expandedHeight + topInset; const barHeight = collapsedHeight + topInset; const distance = heroHeight - barHeight; const clamp = (v: number) => Math.min(1, Math.max(0, v)); const compactTitleOpacity = clamp((scrollTop - (distance - 56)) / 56); const heroOpacity = 1 - clamp(scrollTop / (distance * 0.85)); const heroTranslate = -clamp(scrollTop / distance) * distance * 0.25; const gradient = `linear-gradient(180deg, ${gradientColors .map((c, i) => `${c} ${(i / (gradientColors.length - 1)) * 100}%`) .join(', ')})`; return (