Skip to content

Commit 41b289f

Browse files
Damian Sznajderosdnk
authored andcommitted
feat: add simultaneousHandlers prop
Hi! I've faced an issue with Lists inside BottomSheet, and I could not manage to make them work without adding simultaneousHandlers to every GH. Maybe I misunderstood sth but I've tried to play around with innerGestureHandlerRefs but still, I could not make FlatList scrollable unless enabledGestureInteraction was false. Expo example with broken and working FlatList: https://snack.expo.io/@dsznajder/bottomsheet-with-flatlist
1 parent db80164 commit 41b289f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class Example extends React.Component {
7171
| overdragResistanceFactor | no | 0 | `Defines how violently sheet has to stopped while overdragging. 0 means no overdrag |
7272
| springConfig | no | `{ }` | Overrides config for spring animation |
7373
| innerGestureHandlerRefs | no | | Refs for gesture handlers used for building bottom sheet. The array consists fo three refs. The first for PanGH used for inner content scrolling. The second for PanGH used for header. The third for TapGH used for stopping scrolling the content. |
74+
| simultaneousHandlers | no | | Accepts a react ref object or an array of refs to handler components. |
7475

7576

7677
## Methods

src/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ type Props = {
6464
*/
6565
overdragResistanceFactor: number
6666

67+
/**
68+
* Array of Refs passed to gesture handlers for simultaneous event handling
69+
*/
70+
simultaneousHandlers: Array<React.RefObject<any>> | React.RefObject<any>
71+
6772
/**
6873
* Overrides config for spring animation
6974
*/
@@ -708,6 +713,7 @@ export default class BottomSheetBehavior extends React.Component<Props, State> {
708713
waitFor={this.panRef}
709714
onGestureEvent={this.handleMasterPan}
710715
onHandlerStateChange={this.handleMasterPan}
716+
simultaneousHandlers={this.props.simultaneousHandlers}
711717
>
712718
<Animated.View
713719
style={{
@@ -732,12 +738,14 @@ export default class BottomSheetBehavior extends React.Component<Props, State> {
732738
ref={this.panRef}
733739
onGestureEvent={this.handlePan}
734740
onHandlerStateChange={this.handlePan}
741+
simultaneousHandlers={this.props.simultaneousHandlers}
735742
>
736743
<Animated.View>
737744
<TapGestureHandler
738745
ref={this.tapRef}
739746
enabled={this.props.enabledGestureInteraction}
740747
onHandlerStateChange={this.handleTap}
748+
simultaneousHandlers={this.props.simultaneousHandlers}
741749
>
742750
<Animated.View
743751
style={{

0 commit comments

Comments
 (0)