Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function YourAppContent() {

Adapters with 3rd-party dependencies are shipped as separate subpath exports so that importing the main package never triggers Metro resolution errors for uninstalled libraries. Each sheet in the stack can use a different adapter.

`SwmansionSheetAdapter` also adds a few opt-in conveniences over the bare native sheet (`handle`, `fullHeight`, `fillContent`, `keyboardBehavior`) — see [Shipped Adapters](https://github.com/arekkubaczkowski/react-native-bottom-sheet-stack/blob/main/docs/docs/built-in-adapters.md#convenience-props).
`SwmansionSheetAdapter` also adds a few opt-in conveniences over the bare native sheet (`handle`, `fullHeight`, `fillContent`, `keyboardBehavior`, `cornerRadius`) — see [SwmansionSheetAdapter](https://github.com/arekkubaczkowski/react-native-bottom-sheet-stack/blob/main/docs/docs/built-in-adapters/swmansion.md#convenience-props).

## License

Expand Down
10 changes: 5 additions & 5 deletions docs/docs/api/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ Adapters with 3rd-party dependencies are shipped as separate subpath exports:

| Adapter | Import | Library | Docs |
|---------|--------|---------|------|
| `GorhomSheetAdapter` | `react-native-bottom-sheet-stack/gorhom` | `@gorhom/bottom-sheet` | [Shipped Adapters](/built-in-adapters) |
| `CustomModalAdapter` | `react-native-bottom-sheet-stack` | Custom Animated View | [Shipped Adapters](/built-in-adapters) |
| `ReactNativeModalAdapter` | `react-native-bottom-sheet-stack/react-native-modal` | `react-native-modal` | [Shipped Adapters](/built-in-adapters) |
| `ActionsSheetAdapter` | `react-native-bottom-sheet-stack/actions-sheet` | `react-native-actions-sheet` | [Shipped Adapters](/built-in-adapters) |
| `SwmansionSheetAdapter` | `react-native-bottom-sheet-stack/swmansion` | `@swmansion/react-native-bottom-sheet` | [Shipped Adapters](/built-in-adapters) |
| `GorhomSheetAdapter` | `react-native-bottom-sheet-stack/gorhom` | `@gorhom/bottom-sheet` | [GorhomSheetAdapter](/built-in-adapters/gorhom) |
| `CustomModalAdapter` | `react-native-bottom-sheet-stack` | Custom Animated View | [CustomModalAdapter](/built-in-adapters/custom-modal) |
| `ReactNativeModalAdapter` | `react-native-bottom-sheet-stack/react-native-modal` | `react-native-modal` | [ReactNativeModalAdapter](/built-in-adapters/react-native-modal) |
| `ActionsSheetAdapter` | `react-native-bottom-sheet-stack/actions-sheet` | `react-native-actions-sheet` | [ActionsSheetAdapter](/built-in-adapters/actions-sheet) |
| `SwmansionSheetAdapter` | `react-native-bottom-sheet-stack/swmansion` | `@swmansion/react-native-bottom-sheet` | [SwmansionSheetAdapter](/built-in-adapters/swmansion) |

:::tip
`BottomSheetManaged` is available as a deprecated re-export from `react-native-bottom-sheet-stack/gorhom` for backward compatibility.
Expand Down
38 changes: 38 additions & 0 deletions docs/docs/built-in-adapters/actions-sheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ActionsSheetAdapter

Wraps [`react-native-actions-sheet`](https://github.com/ammarahm-ed/react-native-actions-sheet) — a zero-dependency action sheet with snap points, gestures, and a SheetManager API.

## Installation

```bash
npm install react-native-actions-sheet
```

## Usage

```tsx
import { ActionsSheetAdapter } from 'react-native-bottom-sheet-stack/actions-sheet';

function MyActionsSheet() {
const { close } = useBottomSheetContext();

return (
<ActionsSheetAdapter snapPoints={[50, 100]} gestureEnabled>
<View style={{ padding: 20 }}>
<Text>Actions sheet with snap points</Text>
<Button title="Close" onPress={close} />
</View>
</ActionsSheetAdapter>
);
}
```

## Props

All [`react-native-actions-sheet` props](https://github.com/ammarahm-ed/react-native-actions-sheet#actionsheet-props) are accepted via spread.

Adapter defaults (overridable): `gestureEnabled`, `closeOnTouchBackdrop`, `closeOnPressBack`, `keyboardHandlerEnabled`.

:::tip
This adapter uses `isModal={false}` internally to avoid wrapping in a redundant Modal — the stack manager handles the overlay lifecycle.
:::
42 changes: 42 additions & 0 deletions docs/docs/built-in-adapters/custom-modal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# CustomModalAdapter

Custom React Native dialog UI. No additional dependencies needed.

## Usage

```tsx
import { CustomModalAdapter, useBottomSheetContext } from 'react-native-bottom-sheet-stack';

function MyModal() {
const { close } = useBottomSheetContext();

return (
<CustomModalAdapter>
<View style={{ flex: 1, padding: 20 }}>
<Text>Modal content</Text>
<Button title="Close" onPress={close} />
</View>
</CustomModalAdapter>
);
}
```

## Props

Accepts `contentContainerStyle` for the inner wrapper view.

## Mixed Stacking

Modals and bottom sheets can coexist in the same stack:

```tsx
const { open } = useBottomSheetManager();
const modalControl = useBottomSheetControl('my-modal');

// Push a bottom sheet
open(<MyBottomSheet />, { mode: 'push' });

// Then push a modal on top
modalControl.open({ mode: 'push' });
// Both are in the stack — closing the modal returns to the bottom sheet
```
57 changes: 57 additions & 0 deletions docs/docs/built-in-adapters/gorhom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# GorhomSheetAdapter

The default adapter. Wraps `@gorhom/bottom-sheet` to provide feature-rich bottom sheets with snap points, spring animations, and swipe gestures.

:::tip
`BottomSheetManaged` is available as a deprecated re-export from the same subpath for backward compatibility.
:::

## Installation

```bash
npm install @gorhom/bottom-sheet react-native-reanimated react-native-gesture-handler
```

## Usage

```tsx
import { GorhomSheetAdapter } from 'react-native-bottom-sheet-stack/gorhom';
import { BottomSheetView } from '@gorhom/bottom-sheet';

const MySheet = forwardRef((props, ref) => {
const { close } = useBottomSheetContext();

return (
<GorhomSheetAdapter ref={ref} snapPoints={['50%', '90%']}>
<BottomSheetView>
<Text>Sheet content</Text>
<Button title="Close" onPress={close} />
</BottomSheetView>
</GorhomSheetAdapter>
);
});
```

## Props

Accepts all props from [`@gorhom/bottom-sheet`](https://gorhom.dev/react-native-bottom-sheet/props). The adapter overrides `enablePanDownToClose` to `true` by default.

## Backdrop

By default this adapter renders gorhom's `backdropComponent` as `null` so the **stack manager's shared backdrop** (`BottomSheetBackdrop`) is used instead. This is recommended — the manager's backdrop is **stack-aware** (correct opacity across stacked sheets, z-index, scale coordination, cascading tap-to-dismiss), which a per-sheet gorhom backdrop is not.

You **can** override it by passing your own `backdropComponent`, but it's **not recommended** unless you specifically need gorhom's backdrop behavior. When you do, the adapter **automatically disables the manager backdrop** for that sheet so the two never stack:

```tsx
import { BottomSheetBackdrop as GorhomBackdrop } from '@gorhom/bottom-sheet';

<GorhomSheetAdapter snapPoints={['50%']} backdropComponent={GorhomBackdrop}>
{/* ... */}
</GorhomSheetAdapter>;
```

## When to Use

- You need snap points, scrollable content, keyboard handling
- You want the most feature-rich bottom sheet experience
- Your app already uses `@gorhom/bottom-sheet`
18 changes: 18 additions & 0 deletions docs/docs/built-in-adapters/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
slug: /built-in-adapters
sidebar_label: Overview
---

# Shipped Adapters

All adapters listed below ship with the library. `CustomModalAdapter` requires no additional dependencies. The others wrap optional peer dependencies — install only what you use.

| Adapter | Import | Wraps |
| --- | --- | --- |
| [GorhomSheetAdapter](./gorhom.md) | `react-native-bottom-sheet-stack/gorhom` | `@gorhom/bottom-sheet` |
| [SwmansionSheetAdapter](./swmansion.md) | `react-native-bottom-sheet-stack/swmansion` | `@swmansion/react-native-bottom-sheet` (Fabric / New Arch) |
| [CustomModalAdapter](./custom-modal.md) | `react-native-bottom-sheet-stack` | Custom animated view (zero deps) |
| [ReactNativeModalAdapter](./react-native-modal.md) | `react-native-bottom-sheet-stack/react-native-modal` | `react-native-modal` |
| [ActionsSheetAdapter](./actions-sheet.md) | `react-native-bottom-sheet-stack/actions-sheet` | `react-native-actions-sheet` |

Each sheet in the stack can use a different adapter. See [Library-Agnostic Architecture](/adapters) for how adapters work, or [Building Custom Adapters](/custom-adapters) to create your own.
39 changes: 39 additions & 0 deletions docs/docs/built-in-adapters/react-native-modal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# ReactNativeModalAdapter

Wraps [`react-native-modal`](https://github.com/react-native-modal/react-native-modal) — a feature-rich modal with 60+ animation options, swipe-to-dismiss, and customizable backdrops.

## Installation

```bash
npm install react-native-modal
```

## Usage

```tsx
import { ReactNativeModalAdapter } from 'react-native-bottom-sheet-stack/react-native-modal';

function FancyModal() {
const { close } = useBottomSheetContext();

return (
<ReactNativeModalAdapter
animationIn="slideInUp"
animationOut="slideOutDown"
swipeDirection="down"
backdropOpacity={0.6}
>
<View style={{ flex: 1, padding: 20 }}>
<Text>Fancy animated modal</Text>
<Button title="Close" onPress={close} />
</View>
</ReactNativeModalAdapter>
);
}
```

## Props

All [`react-native-modal` props](https://github.com/react-native-modal/react-native-modal#available-props) are accepted via spread.

Adapter defaults (overridable): `swipeDirection="down"`, `backdropOpacity={0.5}`, `useNativeDriver`, `hideModalContentWhileAnimating`.
Loading
Loading