百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

react-native-collapsible-header-views

> 前端框架
开源

ScrollView、FlatList、带可折叠标题的 SectionList + 用于包装自定义滚动组件的 HOC

197 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

ScrollView、FlatList、带可折叠标题的 SectionList + 用于包装自定义滚动组件的 HOC

react-native-collapsible-header-views

ScrollView, FlatList, SectionList with collapsible headers + HOC for wrapping custom scrollables

Getting started

$ npm install react-native-collapsible-header-views --save

Demo

Android iOS

Example

javascript
import * as React from 'react';
import { View, Platform } from 'react-native';
import { CollapsibleHeaderScrollView } from 'react-native-collapsible-header-views';

export const Basic = () => (
  }
    headerHeight={100}
    statusBarHeight={Platform.OS === 'ios' ? 20 : 0}
  >
    
  
);

Description

Library exports three components CollapsibleHeaderScrollView, CollapsibleHeaderFlatList, CollapsibleHeaderSectionList and a HOC withCollapsibleHeader for wrapping custom scrollable components. Provided components support all props and instance methods of corresponding wrapped components. Note that components are also wrapped with Animated.createAnimatedComponent under the hood.

Reference

Props

CollapsibleHeaderScrollViewProps, CollapsibleHeaderFlatListProps, CollapsibleHeaderSectionListProps

  • CollapsibleHeaderComponent: React.ReactElement | React.ComponentType - React element or component/function that receives CollapsibleHeaderProps object. Required;
  • headerHeight: number - height of CollapsibleHeaderComponent. Required;
  • statusBarHeight?: number - height of status bar. Defaults to 0;
  • headerContainerBackgroundColor?: string - background color for CollapsibleHeaderComponent and status bar container. Defaults to 'white';
  • disableHeaderSnap?: boolean - pass true to disable header snap animations. Defaults to false;
  • headerAnimationDuration?: number - duration of snap and showHeader, hideHeader animations. Defaults to 350;
  • clipHeader?: boolean - if true header will be clipped with overflow: 'hidden' style.

Also some of ScrollView props have new defaults: bounces defaults to false, overScrollMode to 'never' and scrollEventThrottle to 1.

CollapsibleHeaderProps

  • interpolatedHeaderTranslation: (from: number, to: number) => Animated.AnimatedInterpolation - creates new AnimatedInterpolation object, whose input range corresponds to header translation and output range is specified by from and to params. Can be used for custom animations, like setting opacity etc.;
  • showHeader: (options: { animated: boolean } | unknown) => void - pushes header down with animation enabled by default;
  • hideHeader: (options: { animated: boolean } | unknown) => void - pulls header up with animation enabled by default.

Methods

CollapsibleHeaderScrollView, CollapsibleHeaderFlatList, CollapsibleHeaderSectionList

  • animatedComponent: () => any | null - returns result of Animated.createAnimatedComponent applied to original component;
  • showHeader: (options: { animated: boolean } | unknown) => void - pushes header down with animation enabled by default;
  • hideHeader: (options: { animated: boolean } | unknown) => void - pulls header up with animation enabled by default.

withCollapsibleHeader

  • function withCollapsibleHeader(Component: React.ComponentClass): React.ComponentClass> - creates new component with collapsible header, it is assumed that input component has all of ScrollView props.

Credits

  • Key concepts were taken from collapsible-navbar demo by @janicduplessis

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptcollapsibleheaderreact-native

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架