7
7
HandlerType ,
8
8
Manager ,
9
9
PanGestureHandler ,
10
- install as installGestures ,
10
+ install as installGestures
11
11
} from '@nativescript-community/gesturehandler' ;
12
12
import { Animation , AnimationDefinition , CSSType , Color , EventData , GridLayout , Property , ScrollEventData , ScrollView , TouchGestureEventData , Utils , View , booleanConverter } from '@nativescript/core' ;
13
13
import { AnimationCurve } from '@nativescript/core/ui/enums' ;
@@ -37,34 +37,34 @@ export const scrollViewProperty = new Property<PersistentBottomSheet, string>({
37
37
defaultValue : undefined ,
38
38
valueChanged : ( target , oldValue , newValue ) => {
39
39
( target as any ) . _onScrollViewIdChanged ( oldValue , newValue ) ;
40
- } ,
40
+ }
41
41
} ) ;
42
42
export const bottomSheetProperty = new Property < PersistentBottomSheet , View > ( {
43
43
name : 'bottomSheet' ,
44
44
defaultValue : undefined ,
45
45
valueChanged : ( target , oldValue , newValue ) => {
46
46
( target as any ) . _onBottomSheetChanged ( oldValue , newValue ) ;
47
- } ,
47
+ }
48
48
} ) ;
49
49
export const gestureEnabledProperty = new Property < PersistentBottomSheet , boolean > ( {
50
50
name : 'gestureEnabled' ,
51
51
defaultValue : true ,
52
- valueConverter : booleanConverter ,
52
+ valueConverter : booleanConverter
53
53
} ) ;
54
54
export const stepsProperty = new Property < PersistentBottomSheet , number [ ] > ( {
55
55
name : 'steps' ,
56
- defaultValue : [ 70 ] ,
56
+ defaultValue : [ 70 ]
57
57
} ) ;
58
58
export const stepIndexProperty = new Property < PersistentBottomSheet , number > ( {
59
59
name : 'stepIndex' ,
60
- defaultValue : 0 ,
60
+ defaultValue : 0
61
61
} ) ;
62
62
export const backdropColorProperty = new Property < PersistentBottomSheet , Color > ( {
63
63
name : 'backdropColor' ,
64
- valueConverter : ( c ) => ( c ? new Color ( c ) : null ) ,
64
+ valueConverter : ( c ) => ( c ? new Color ( c ) : null )
65
65
} ) ;
66
66
export const translationFunctionProperty = new Property < PersistentBottomSheet , Function > ( {
67
- name : 'translationFunction' ,
67
+ name : 'translationFunction'
68
68
} ) ;
69
69
70
70
@CSSType ( 'PersistentBottomSheet' )
@@ -119,7 +119,7 @@ export class PersistentBottomSheet extends GridLayout {
119
119
simultaneousHandlers : [ NATIVE_GESTURE_TAG ] ,
120
120
// shouldCancelWhenOutside: true,
121
121
// activeOffsetX: this.leftSwipeDistance,
122
- minDist : SWIPE_DISTANCE_MINIMUM ,
122
+ minDist : SWIPE_DISTANCE_MINIMUM
123
123
// failOffsetX: SWIPE_DISTANCE_MINIMUM,
124
124
} ) ;
125
125
gestureHandler . on ( GestureHandlerTouchEvent , this . onGestureTouch , this ) ;
@@ -128,6 +128,9 @@ export class PersistentBottomSheet extends GridLayout {
128
128
this . panGestureHandler = gestureHandler as any ;
129
129
}
130
130
protected shouldStartGesture ( data ) {
131
+ if ( this . steps . length === 0 || ( this . steps . length === 1 && this . steps [ 0 ] === 0 ) ) {
132
+ return false ;
133
+ }
131
134
const safeAreatop = Utils . layout . toDeviceIndependentPixels ( this . getSafeAreaInsets ( ) . top ) ;
132
135
const y = data . y - safeAreatop ;
133
136
// console.log('shouldStartGesture ', safeAreatop, data, y, this.viewHeight - (this.translationMaxOffset - this.translationY), this.translationY, this.translationMaxOffset, this.viewHeight);
@@ -230,7 +233,6 @@ export class PersistentBottomSheet extends GridLayout {
230
233
this . insertChild ( this . backDrop , index ) ;
231
234
}
232
235
233
-
234
236
get scrollView ( ) {
235
237
return this . _scrollView ;
236
238
}
@@ -303,11 +305,11 @@ export class PersistentBottomSheet extends GridLayout {
303
305
}
304
306
return {
305
307
bottomSheet : {
306
- translateY : value ,
308
+ translateY : value
307
309
} ,
308
310
backDrop : {
309
- opacity : progress ,
310
- } ,
311
+ opacity : progress
312
+ }
311
313
} ;
312
314
}
313
315
private onLayoutChange ( event : EventData ) {
@@ -518,7 +520,7 @@ export class PersistentBottomSheet extends GridLayout {
518
520
return Object . assign (
519
521
{
520
522
curve : AnimationCurve . easeOut ,
521
- duration,
523
+ duration
522
524
} ,
523
525
transformAnimationValues ( trData [ k ] )
524
526
) ;
@@ -527,7 +529,7 @@ export class PersistentBottomSheet extends GridLayout {
527
529
{
528
530
target : this [ k ] ,
529
531
curve : AnimationCurve . easeOut ,
530
- duration,
532
+ duration
531
533
} ,
532
534
transformAnimationValues ( trData [ k ] )
533
535
) ;
0 commit comments