@@ -69,7 +69,6 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
69
69
private snaps : number [ ] = [ ] ;
70
70
private snapEnd : number ;
71
71
private beginScrollYValue : number = 0 ;
72
- private contentAlreadyCalculated : boolean = false ;
73
72
private beginScrollY : Animated . Value = new Animated . Value ( 0 ) ;
74
73
private dragY : Animated . Value = new Animated . Value ( 0 ) ;
75
74
private translateY : Animated . Value = new Animated . Value ( screenHeight ) ;
@@ -158,17 +157,13 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
158
157
}
159
158
160
159
public open = ( ) : void => {
161
- const { adjustToContentHeight , onOpen } = this . props ;
160
+ const { onOpen } = this . props ;
162
161
163
162
if ( onOpen ) {
164
163
onOpen ( ) ;
165
164
}
166
165
167
- if ( ! adjustToContentHeight || this . contentAlreadyCalculated ) {
168
- this . onAnimateOpen ( ) ;
169
- } else {
170
- this . setState ( { isVisible : true } ) ;
171
- }
166
+ this . onAnimateOpen ( ) ;
172
167
} ;
173
168
174
169
public close = ( dest : 'alwaysOpen' | 'default' = 'default' ) : void => {
@@ -375,36 +370,6 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
375
370
} ) ;
376
371
} ;
377
372
378
- private onContentViewLayout = ( { nativeEvent } : LayoutChangeEvent ) : void => {
379
- const { adjustToContentHeight, snapPoint, alwaysOpen } = this . props ;
380
- const { contentHeight, modalHeight } = this . state ;
381
-
382
- if (
383
- ! adjustToContentHeight ||
384
- ( modalHeight || 0 ) <= nativeEvent . layout . height ||
385
- snapPoint ||
386
- this . contentAlreadyCalculated
387
- ) {
388
- if ( ( modalHeight || 0 ) <= nativeEvent . layout . height ) {
389
- this . onAnimateOpen ( alwaysOpen ) ;
390
- }
391
-
392
- return ;
393
- }
394
-
395
- // @todo : modalHeight should be equal to the nativeEvent's height,
396
- // and not to the state's value which is 0 at the first mount
397
- this . setState (
398
- {
399
- contentHeight : nativeEvent . layout . height || contentHeight ,
400
- } ,
401
- ( ) => {
402
- this . contentAlreadyCalculated = true ;
403
- this . onAnimateOpen ( ) ;
404
- } ,
405
- ) ;
406
- } ;
407
-
408
373
private onHandleComponent = ( { nativeEvent } : PanGestureHandlerStateChangeEvent ) : void => {
409
374
if ( nativeEvent . oldState === State . BEGAN ) {
410
375
this . beginScrollY . setValue ( 0 ) ;
@@ -611,7 +576,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
611
576
{ useNativeDriver : false } ,
612
577
) ,
613
578
scrollEventThrottle : 16 ,
614
- onLayout : this . onContentViewLayout ,
579
+ keyboardDismissMode ,
615
580
} ;
616
581
617
582
if ( flatListProps ) {
@@ -623,7 +588,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
623
588
}
624
589
625
590
return (
626
- < Animated . ScrollView { ...opts } { ...scrollViewProps } keyboardDismissMode = { keyboardDismissMode } >
591
+ < Animated . ScrollView { ...opts } { ...scrollViewProps } >
627
592
{ children }
628
593
</ Animated . ScrollView >
629
594
) ;
0 commit comments