Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: added methods & hook to readme file #5

Merged
merged 1 commit into from
Aug 12, 2020
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
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