Skip to content

Commit

Permalink
docs: added methods & hook to readme file (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed Aug 12, 2020
1 parent 9c92c71 commit eb11614
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ A performant interactive bottom sheet with fully configurable options 🚀
- [React Navigation Integration](./docs/react-navigation.md)
- [Touchables](./docs/touchables.md)
4. [Props](#props)
5. [Scrollables](#scrollables)
5. [Methods](#methods)
6. [Hooks](#hooks)
7. [Scrollables](#scrollables)
- [BottomSheetFlatList](./docs/flatlist.md)
- [BottomSheetSectionList](./docs/sectionlist.md)
- [BottomSheetScrollView](./docs/scrollview.md)
- [BottomSheetView](./docs/flatlist.md)
6. [To Do](#to-do)
7. [Credits](#built-with)
8. [License](#license)
8. [To Do](#to-do)
9. [Credits](#built-with)
10. [License](#license)

## Features

Expand Down Expand Up @@ -160,6 +162,28 @@ A scrollable node or normal view.

> `required:` YES | `type:` React.ReactNode[] | React.ReactNode
## Methods

#### `snapTo`

Snap to one of the provided points from `snapPoints`.

> `type:` (index: number) => void
#### `close`

Close the bottom sheet.

> `type:` () => void
## Hooks

#### `useBottomSheet`

The library provide `useBottomSheet` hook to provide the bottom sheet methods, anywhere inside the sheet content.

> `type:` { snapTo: () => void, close: () => void }
## Scrollables

This library provides a pre-integrated views that utilise an internal functionalities with the bottom sheet to allow smooth interactions. These views i called them `Scrollables` and they are:
Expand Down
8 changes: 8 additions & 0 deletions src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ import type { BottomSheetProps } from './types';
import { styles } from './styles';

interface BottomSheet {
/**
* Snap to one of the provided points from `snapPoints`.
* @type (index: number) => void
*/
snapTo: (index: number) => void;
/**
* Close the bottom sheet.
* @type () => void
*/
close: () => void;
}

Expand Down
8 changes: 8 additions & 0 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ export const BottomSheetInternalContext = createContext<
export const BottomSheetInternalProvider = BottomSheetInternalContext.Provider;

export interface BottomSheetContextType {
/**
* Snap to one of the provided points from `snapPoints`.
* @type (index: number) => void
*/
snapTo: (index: number) => void;
/**
* Close the bottom sheet.
* @type () => void
*/
close: () => void;
}

Expand Down

0 comments on commit eb11614

Please sign in to comment.