# @r0b0t3d/react-native-collapsible

> Fully customizable collapsible views

Latest version **1.5.3** (published 2026-04-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @r0b0t3d/react-native-collapsible
pnpm add @r0b0t3d/react-native-collapsible
yarn add @r0b0t3d/react-native-collapsible
bun add @r0b0t3d/react-native-collapsible
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.5.3 |
| Published | 2026-04-30 |
| First published | 2021-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 16.0.0 |
| Dependencies | 0 |
| Unpacked size | 340 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 52 |
| Author | Tuan Luong |
| Maintainers | tuanluong |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/@r0b0t3d/react-native-collapsible
- Repository: https://github.com/r0b0t3d/react-native-collapsible
- Homepage: https://github.com/r0b0t3d/react-native-collapsible#readme
- Issues: https://github.com/r0b0t3d/react-native-collapsible/issues
- npm.io page: https://npm.io/package/@r0b0t3d/react-native-collapsible

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.5.3 (latest) — 2026-04-30
- 1.6.0-alpha.1 (alpha) — 2026-06-29
- 1.3.5-beta.7 (beta) — 2023-07-17
- 1.6.0-alpha.0 — 2026-06-20
- 1.5.2 — 2026-04-11
- 1.5.1 — 2025-11-03
- 1.5.0 — 2025-10-13
- 1.5.0-alpha.7 — 2025-05-29
- 1.5.0-alpha.6 — 2025-05-29
- 1.5.0-alpha.5 — 2025-05-02
- 1.5.0-alpha.4 — 2025-05-02
- 1.5.0-alpha.3 — 2025-05-01
- 1.5.0-alpha.2 — 2023-10-16
- 1.5.0-alpha.1 — 2023-09-22
- 1.5.0-alpha.0 — 2023-09-22
- … 45 more at https://npm.io/package/@r0b0t3d/react-native-collapsible/versions

## README

# @r0b0t3d/react-native-collapsible

Fully customizable collapsible views

![alt text](pictures/intro.gif 'Intro')

## Installation

```sh
yarn add @r0b0t3d/react-native-collapsible
```

I am using `reanimated 2` for animation. So you should install and follow instruction here to setup your project [react-native-reanimated](https://docs.swmansion.com/react-native-reanimated/docs/installation)

## Key features
1️⃣ Support FlatList/ScrollView
2️⃣ Support sticky header
3️⃣ Can have multiple sticky headers
4️⃣ Easy to customize

## Usage
### 1. Basic
```jsx
import {
  CollapsibleContainer,
  CollapsibleFlatList,
  CollapsibleScrollView,
} from '@r0b0t3d/react-native-collapsible';

// ...
const MyComponent = () => {
  const {
    collapse,   // <-- Collapse header
    expand,     // <-- Expand header
    scrollY,    // <-- Animated scroll position. In case you need to do some animation in your header or somewhere else
  } = useCollapsibleContext();

  return (
    <CollapsibleContainer>          // 1️⃣ (Required) Outermost container 
      <CollapsibleHeaderContainer>  // 2️⃣ (Required) Header view
        <!-- Your header view -->
        <StickyView>                // 3️⃣ Sticky view
          <!-- Your sticky view goes here -->
        </StickyView>
      </CollapsibleHeaderContainer>
      <CollapsibleFlatList          // 4️⃣ (Required) Your FlatList/ScrollView
        data={data}
        renderItem={renderItem}
        headerSnappable={false} // <-- should header auto snap when you release the finger
      />
    </CollapsibleContainer>
  )
}

export default withCollapsibleContext(MyComponent); // 5️⃣ (Required)wrap your component with `withCollapsibleContext`
```

### 2. Advance
We support multiple `CollapsibleHeaderContainer` and `StickyView`. It come useful in case you need to break your code into smaller component.

`Parent.tsx`
```jsx
const Parent = () => {
  const [tabIndex, setTabIndex] = useState(0)

  return (
    <CollapsibleContainer>
      <CollapsibleHeaderContainer>
        <!-- Your header view -->
        <StickyView>
          <TabView currentTab={tabIndex} onTabChange={setTabIndex} />
        </StickyView>
      </CollapsibleHeaderContainer>

      {tabIndex === 0 && <FirstTab />}
      {tabIndex === 1 && <SecondTab />}
    </CollapsibleContainer>
  )
}
```

`FirstTab.tsx`
```jsx
const FirstTab = () => {
  return (
    <>
      <CollapsibleHeaderContainer>
        <!-- 😍 You can have another headerview in each tab where you can add another StickyView there -->
        <StickyView>
          <!-- Your sticky view goes here -->
        </StickyView>
        <View />
        <StickyView>
          <!-- 🚀 Bonus, multiple sticky view -->
        </StickyView>
      </CollapsibleHeaderContainer>
      <CollapsibleFlatList
        data={data}
        renderItem={renderItem}
      />
    </>
  )
}
```

## Showcases
```
Note: Feel free to add your showcase here by a PR
```
| App         | Gif         |
| ----------- | ----------- |
| [ANU Global](https://apps.apple.com/us/app/anu-global/id1540735849) | <img src="/pictures/showcases/anu.gif" height="350"/> |

## Breaking changes

### 1.0.0

- Removed

  - `persistHeaderHeight`
  - `contentMinHeight`

- Added
  - `CollapsibleContainer`
  - `StickyView`

## Tips

#### 1. Trigger scroll when scroll inside `CollapsibleHeaderContainer`

- If your header doesn't contains touchable component, try `pointerEvents="none"`

```jsx
<CollapsibleHeaderContainer>
  <View pointerEvents="none">
    <Text>Header</Text>
  </View>
</CollapsibleHeaderContainer>
```

- If your header contains touchable componet, try to set `pointerEvents="box-none"` for every nested views that contains touchable, otherwise use `pointerEvents="none"`

```jsx
<CollapsibleHeaderContainer>
    <View pointerEvents="box-none"> // <-- this is parent view
        <View pointerEvents="none"> // <-- this view doesn't contain touchable component
            <Text>Header</Text>
        </View>
        <View pointerEvents="box-none"> // <-- this view contain touchable component
            <View pointerEvents="none">
                <Text>Some text</Text>
            </View>
            <TouchableOpacity>
                <Text>Button</Text>
            </TouchableOpacity>
        </View>
    </View>
</CollapsibleHeaderContainer>
```

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---
_Source: https://npm.io/package/@r0b0t3d/react-native-collapsible · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
