@@ -64,10 +64,6 @@ export const gestureEnabledProperty = new Property<PersistentBottomSheet, boolea
6464 defaultValue : true ,
6565 valueConverter : booleanConverter
6666} ) ;
67- export const stepsProperty = new Property < PersistentBottomSheet , number [ ] > ( {
68- name : 'steps' ,
69- defaultValue : [ 70 ]
70- } ) ;
7167export const stepIndexProperty = new Property < PersistentBottomSheet , number > ( {
7268 name : 'stepIndex' ,
7369 defaultValue : 0
@@ -109,6 +105,8 @@ export class PersistentBottomSheet extends AbsoluteLayout {
109105
110106 private animation : Animation ;
111107
108+ private _allowBottomSheetAdd = false ;
109+
112110 constructor ( ) {
113111 super ( ) ;
114112 this . isPassThroughParentEnabled = true ;
@@ -121,6 +119,10 @@ export class PersistentBottomSheet extends AbsoluteLayout {
121119 }
122120 set steps ( value : number [ ] ) {
123121 this . _steps = value ;
122+
123+ if ( this . _steps ?. length ) {
124+ this . alignToStepPosition ( ) ;
125+ }
124126 }
125127
126128 // nativeGestureHandler: PanGestureHandler;
@@ -269,9 +271,8 @@ export class PersistentBottomSheet extends AbsoluteLayout {
269271 this . scrollView = null ;
270272 }
271273 }
272- allowBottomSheetAdd = false
273274 addChild ( child ) {
274- if ( child === this . bottomSheet && ! this . allowBottomSheetAdd ) {
275+ if ( child === this . bottomSheet && ! this . _allowBottomSheetAdd ) {
275276 return ;
276277 }
277278 super . addChild ( child ) ;
@@ -300,9 +301,9 @@ export class PersistentBottomSheet extends AbsoluteLayout {
300301 let index ;
301302 if ( ! newValue . parent ) {
302303 index = this . getChildrenCount ( ) ;
303- this . allowBottomSheetAdd = true ;
304+ this . _allowBottomSheetAdd = true ;
304305 this . addChild ( newValue ) ;
305- this . allowBottomSheetAdd = false ;
306+ this . _allowBottomSheetAdd = false ;
306307 } else {
307308 index = this . getChildIndex ( newValue ) ;
308309 }
@@ -336,6 +337,19 @@ export class PersistentBottomSheet extends AbsoluteLayout {
336337 }
337338 } ;
338339 }
340+ private alignToStepPosition ( ) {
341+ if ( ! this . bottomSheet ) {
342+ return ;
343+ }
344+
345+ const steps = this . steps ;
346+ const step = steps [ Math . min ( this . stepIndex , steps . length - 1 ) ] ;
347+ const ty = step ;
348+
349+ this . translationY = - ty ;
350+ const data = this . computeTranslationData ( ) ;
351+ this . applyTrData ( data ) ;
352+ }
339353 private onLayoutChange ( event : EventData ) {
340354 const contentView = event . object as GridLayout ;
341355 const height = Math . round ( Utils . layout . toDeviceIndependentPixels ( contentView . getMeasuredHeight ( ) ) ) ;
@@ -346,13 +360,8 @@ export class PersistentBottomSheet extends AbsoluteLayout {
346360 value : contentView . getMeasuredHeight ( )
347361 } ;
348362 }
349- if ( this . translationY === - 1 && this . bottomSheet ) {
350- const steps = this . steps ;
351- const step = steps [ this . stepIndex ] ;
352- const ty = step ;
353- this . translationY = - ty ;
354- const data = this . computeTranslationData ( ) ;
355- this . applyTrData ( data ) ;
363+ if ( this . translationY === - 1 ) {
364+ this . alignToStepPosition ( ) ;
356365 }
357366 }
358367 private get scrollViewVerticalOffset ( ) {
0 commit comments