feat: add high-level collapsible header API - #27
Draft
pawicao wants to merge 2 commits into
Draft
Conversation
Adds Collapsible and CollapsibleTabs compound components, a composable preset system, pluggable pager adapters, contextual scrollId resolution, and the useCollapsibleHeader hook. All changes are additive on top of the existing low-level primitives. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds one example screen per built-in preset (collapse, fade, parallax, scale, none) through a shared PresetShowcaseScreen component, a custom preset example (createCollapsiblePreset with a 3D fold and header tint), and an overlay example that uses Collapsible.Header without NavigationHeader. Replaces the previous collapsible-simple screen, which the parallax preset screen now covers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a high-level API for collapsible headers. The new API uses the low-level primitives. It does not change their behavior. All changes are additive.
Collapsible
Collapsibleis a compound component. You compose the header from explicit parts:Collapsibleis the root. It contains theHeaderMotionprovider and the resolved preset. It has no visual output.Collapsible.Headeris the header frame. It measures the full header height. It moves up while the user scrolls.Collapsible.Pinnedholds content that must stay in view. It moves against the frame to keep its position.Collapsible.Dynamicis the section that collapses. Its measured height sets the collapse distance. The active preset animates its content.Collapsible.NavigationHeadergives the header to a navigation library. It replaces the manualBridgeandNavigationBridgesteps. It moves all contexts across the tree boundary.Collapsible.ScrollViewandCollapsible.FlatListare the same components as theHeaderMotionscrollables.Presets
A preset tells the collapsing content how to animate. The parts keep their own base motion. Because of this, presets combine without conflicts.
collapse,fade,parallax,scale,none.preset={['collapse', CollapsiblePresets.fade({ to: 0.5 })]}.createCollapsiblePreset()makes a custom preset. A preset is a worklet. It gets the motion state and returns styles for each part.CollapsibleTabs
CollapsibleTabsshares one header across many pages:activeScrollIdwiring.CollapsibleTabs.Tabgives its name to the scrollables inside as the defaultscrollId. New context:HeaderMotionScrollIdContext. An explicitscrollIdprop wins. Custom scrollables fromcreateHeaderMotionScrollable()also get this behavior.CollapsibleTabs.Pagershows the pages through a pager adapter.ScrollView. It has no dependencies.createPagerViewAdapter(PagerView)connectsreact-native-pager-view. The app imports the pager, not the library.CollapsibleTabs.Baris a minimal tab bar.useCollapsibleTabs()supplies the data for custom tab bars.Other additions
useCollapsibleHeader()returns the motion values and thecollapse()/expand()controls.onStateChangeon the root reports theexpandedandcollapsedstates.Example screens
The example app gets a "High-level API" section with nine screens:
preset-collapse,preset-fade,preset-parallax,preset-scale,preset-none. They share one showcase component.preset-customshows a custom preset. It folds the content in 3D and tints the header color withinterpolateColor.collapsible-overlaydoes not useNavigationHeader. It hides the navigation header and rendersCollapsible.Headerin place.collapsible-tabsuses thereact-native-pager-viewadapter.collapsible-tabs-default-pageruses the built-in pager and aFlatListtab.Tests
tsc, ESLint, andbob buildcomplete without errors.🤖 Generated with Claude Code