Skip to content

Commit

Permalink
docs: updated documentation website
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed Jan 9, 2021
1 parent ec725a1 commit 50a91e6
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 5 deletions.
4 changes: 2 additions & 2 deletions website/docs/getting-started.mdx
Expand Up @@ -57,7 +57,7 @@ This library provides two versions that are align with `Reanimated v1 & v2`
This version is written with `Reanimated v1` & compatible with `Reanimated v2`:

```bash
yarn add @gorhom/bottom-sheet@2.0.0
yarn add @gorhom/bottom-sheet@^2
```

#### Dependencies
Expand All @@ -79,7 +79,7 @@ yarn add react-native-reanimated react-native-gesture-handler
This version is written with `Reanimated v2` and **CAN NOT RUN** with `Reanimated v1`:

```bash
yarn add @gorhom/bottom-sheet
yarn add @gorhom/bottom-sheet@^3
```

#### Dependencies
Expand Down
58 changes: 57 additions & 1 deletion website/docs/hooks.md
Expand Up @@ -12,7 +12,7 @@ This hook provides all the bottom sheet public [methods](methods), to the intern
> This hook works at any component in `BottomSheet`.
```tsx
import { useBottomSheet} from '@gorhom/bottom-sheet';
import { useBottomSheet } from '@gorhom/bottom-sheet';

const SheetContent = () => {
const { expand } = useBottomSheet();
Expand All @@ -24,3 +24,59 @@ const SheetContent = () => {
)
}
```

## `useBottomSheetSpringConfigs`

**`Available only on v3, for now.`**

Generate animation spring configs.

```tsx
import BottomSheet, { useBottomSheetSpringConfigs } from '@gorhom/bottom-sheet';

const SheetContent = () => {

const animationConfigs = useBottomSheetSpringConfigs({
damping: 80,
overshootClamping: true,
restDisplacementThreshold: 0.1,
restSpeedThreshold: 0.1,
stiffness: 500,
});

return (
<BottomSheet
animationConfigs={animationConfigs}
>
{CONTENT HERE}
</BottomSheet>
)
}
```

## `useBottomSheetSpringConfigs`

**`Available only on v3, for now.`**

Generate animation timing configs.

```tsx
import BottomSheet, { useBottomSheetTimingConfigs } from '@gorhom/bottom-sheet';
import { Easing } from 'react-native-reanimated';

const SheetContent = () => {

const animationConfigs = useBottomSheetTimingConfigs({
duration: 250,
easing: Easing.exp,
});

return (
<BottomSheet
animationConfigs={animationConfigs}
>
{CONTENT HERE}
</BottomSheet>
)
}
```
2 changes: 1 addition & 1 deletion website/docs/modal/hooks.md
Expand Up @@ -19,7 +19,7 @@ const SheetContent = () => {

return (
<View>
<Button onPress={expand}>
<Button onPress={dismiss}>
</View>
)
}
Expand Down
13 changes: 13 additions & 0 deletions website/docs/modal/props.md
Expand Up @@ -16,6 +16,19 @@ Modal name to help identify the modal for later on.
| ------ | ---------------------- | -------- |
| string | `generated unique key` | NO |

### `stackBehavior`

**`Available only on v3, for now.`**

Defines the stack behavior when modal mounts.

- `push` it will mount the modal on top of current modal.
- `replace` it will minimize the current modal then mount the modal.

| type | default | required |
| ------------------- | --------- | -------- |
| 'push' \| 'replace' | 'replace' | NO |

### `dismissOnPanDown`

Dismiss modal when panning down.
Expand Down
117 changes: 116 additions & 1 deletion website/docs/props.md
Expand Up @@ -23,7 +23,9 @@ Points for the bottom sheet to snap to, **points should be sorted from bottom to
| --------------------- | -------- |
| Array<number\|string> | YES |

> 鈿狅笍 String values should be a percentage.
:::caution
String values should be a percentage.
:::

#### examples

Expand Down Expand Up @@ -57,6 +59,16 @@ Top inset value helps to calculate percentage snap points values. usually comes
| ------ | ------- | -------- |
| number | 0 | NO |

### `overDragResistanceFactor`

**`Available only on v3, for now.`**

Defines how violently sheet has to stopped while over dragging.

| type | default | required |
| ------ | ------- | -------- |
| number | 2.5 | NO |

### `enableContentPanningGesture`

Enable content panning gesture interaction.
Expand All @@ -73,6 +85,26 @@ Enable handle panning gesture interaction.
| ------- | ------- | -------- |
| boolean | true | NO |

### `enableOverDrag`

**`Available only on v3, for now.`**

Enable over drag for the sheet.

| type | default | required |
| ------- | ------- | -------- |
| boolean | true | NO |

### `enableFlashScrollableIndicatorOnExpand`

**`Available only on v3, for now.`**

Enable flash the scrollable indicator when the sheet is expanded.

| type | default | required |
| ------- | ------- | -------- |
| boolean | true | NO |

### `animateOnMount`

This will initially mount the sheet closed and when it's mounted and calculated the layout, it will snap to initial snap point index.
Expand All @@ -83,6 +115,27 @@ This will initially mount the sheet closed and when it's mounted and calculated

## Animation Configuration

### `animationConfigs`

**`Available only on v3, for now.`**

Animation configs, this could be created by:

- `useBottomSheetSpringConfigs`
- `useBottomSheetTimingConfigs`

```ts
type animationConfigs = (
point: number,
velocity: number,
callback: () => void
) => number;
```

| type | default | required |
| -------- | --------- | -------- |
| function | undefined | NO |

### `animationDuration`

Snapping animation duration.
Expand All @@ -99,6 +152,68 @@ Snapping animation easing function.
| ---------------- | ------- | -------- |
| `EasingFunction` | @TODO | NO |

## Gesture Configuration

### `waitFor`

**`Available only on v3, for now.`**

[Read about `waitFor`](https://docs.swmansion.com/react-native-gesture-handler/docs/handler-common#waitfor).

| type | default | required |
| ------------------------ | ------- | -------- |
| React.Ref \| React.Ref[] | [] | NO |

### `simultaneousHandlers`

**`Available only on v3, for now.`**

[Read about `simultaneousHandlers`](https://docs.swmansion.com/react-native-gesture-handler/docs/handler-common#simultaneoushandlers).

| type | default | required |
| ------------------------ | ------- | -------- |
| React.Ref \| React.Ref[] | [] | NO |

### `activeOffsetX`

**`Available only on v3, for now.`**

[Read about `activeOffsetX`](https://docs.swmansion.com/react-native-gesture-handler/docs/handler-pan#activeoffsetx).

| type | default | required |
| -------- | --------- | -------- |
| number[] | undefined | NO |

### `activeOffsetY`

**`Available only on v3, for now.`**

[Read about `activeOffsetY`](https://docs.swmansion.com/react-native-gesture-handler/docs/handler-pan#activeoffsety).

| type | default | required |
| -------- | --------- | -------- |
| number[] | undefined | NO |

### `failOffsetX`

**`Available only on v3, for now.`**

[Read about `failOffsetX`](https://docs.swmansion.com/react-native-gesture-handler/docs/handler-pan/#failoffsetx).

| type | default | required |
| -------- | --------- | -------- |
| number[] | undefined | NO |

### `failOffsetY`

**`Available only on v3, for now.`**

[Read about `failOffsetY`](https://docs.swmansion.com/react-native-gesture-handler/docs/handler-pan/#failoffsety).

| type | default | required |
| -------- | --------- | -------- |
| number[] | undefined | NO |

## Animated Nodes

### `animatedIndex`
Expand Down

0 comments on commit 50a91e6

Please sign in to comment.