Skip to content

Commit 4e3c4e5

Browse files
ahmaddehnaviosdnk
authored andcommitted
add new props to control header and content gesture (#78)
add new props to control header and content gesture
1 parent e3b7804 commit 4e3c4e5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/index.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ type Props = {
3333
* Defines if bottom sheet could be scrollable by gesture. Defaults to true.
3434
*/
3535
enabledGestureInteraction?: boolean
36-
36+
enabledHeaderGestureInteraction?: boolean
37+
enabledContentGestureInteraction?: boolean
3738
/**
3839
* If false blocks snapping using snapTo method. Defaults to true.
3940
*/
@@ -270,6 +271,8 @@ export default class BottomSheetBehavior extends React.Component<Props, State> {
270271
initialSnap: 0,
271272
enabledImperativeSnapping: true,
272273
enabledGestureInteraction: true,
274+
enabledHeaderGestureInteraction: true,
275+
enabledContentGestureInteraction: true,
273276
enabledInnerScrolling: true,
274277
springConfig: {},
275278
innerGestureHandlerRefs: [
@@ -517,7 +520,7 @@ export default class BottomSheetBehavior extends React.Component<Props, State> {
517520
cond(lessThan(limitedVal, min), set(limitedVal, min)),
518521
]
519522
),
520-
set(prevState, this.panState), //on iOS sometimes BEGAN event does not trigger
523+
set(prevState, this.panState), // on iOS sometimes BEGAN event does not trigger
521524
set(diffPres, sub(prev, val)),
522525
set(prev, val),
523526
cond(
@@ -708,7 +711,7 @@ export default class BottomSheetBehavior extends React.Component<Props, State> {
708711
}}
709712
>
710713
<PanGestureHandler
711-
enabled={this.props.enabledGestureInteraction}
714+
enabled={this.props.enabledGestureInteraction && this.props.enabledHeaderGestureInteraction}
712715
ref={this.master}
713716
waitFor={this.panRef}
714717
onGestureEvent={this.handleMasterPan}
@@ -733,7 +736,7 @@ export default class BottomSheetBehavior extends React.Component<Props, State> {
733736
}
734737
>
735738
<PanGestureHandler
736-
enabled={this.props.enabledGestureInteraction}
739+
enabled={this.props.enabledGestureInteraction && this.props.enabledContentGestureInteraction}
737740
waitFor={this.master}
738741
ref={this.panRef}
739742
onGestureEvent={this.handlePan}
@@ -743,7 +746,7 @@ export default class BottomSheetBehavior extends React.Component<Props, State> {
743746
<Animated.View>
744747
<TapGestureHandler
745748
ref={this.tapRef}
746-
enabled={this.props.enabledGestureInteraction}
749+
enabled={this.props.enabledGestureInteraction && this.props.enabledContentGestureInteraction}
747750
onHandlerStateChange={this.handleTap}
748751
simultaneousHandlers={this.props.simultaneousHandlers}
749752
>

0 commit comments

Comments
 (0)