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

Custom Scroll Component #43

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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 @@ -170,7 +170,7 @@ This is the list of exclusive props that are meant to be used to customise the b
| `containerStyle` | no | `StyleProp<ViewStyle>` | Style to be applied to the container (Handle and Content) |
| `friction` | no | `number` | Factor of resistance when the gesture is released. A value of 0 offers maximum * acceleration, whereas 1 acts as the opposite. Defaults to 0.95 |
| `enableOverScroll` | yes | `boolean` | Allow drawer to be dragged beyond lowest snap point |

| `customScrollComponent` | no | `ScrollView \| FlatList \| SectionList` | Custom instance of inner scroll element |

### Inherited
Depending on the value of `componentType` chosen, the bottom sheet component will inherit its underlying props, being one of
Expand Down
8 changes: 8 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ type CommonProps = {
* Allow drawer to be dragged beyond lowest snap point
*/
enableOverScroll: boolean;
/*
* Custom inner scrolling component
*/
customScrollComponent: FlatList | ScrollView | SectionList;
};

type TimingAnimationProps = {
Expand Down Expand Up @@ -653,6 +657,10 @@ export class ScrollBottomSheet<T extends any> extends Component<Props<T>> {
};

private getScrollComponent = () => {
if (this.props.customScrollComponent) {
return this.props.customScrollComponent;
}

switch (this.props.componentType) {
case 'FlatList':
return FlatList;
Expand Down