@@ -26,7 +26,7 @@ import {
26
26
TapGestureHandlerStateChangeEvent ,
27
27
} from 'react-native-gesture-handler' ;
28
28
29
- import { IProps , IState } from './options' ;
29
+ import { IProps , IState , TOpen , TClose } from './options' ;
30
30
import { getSpringConfig } from './utils/get-spring-config' ;
31
31
import { isIphoneX , isIos } from './utils/devices' ;
32
32
import { hasAbsoluteStyle } from './utils/has-absolute-style' ;
@@ -147,8 +147,10 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
147
147
}
148
148
149
149
componentDidMount ( ) {
150
- if ( this . props . alwaysOpen ) {
151
- this . onAnimateOpen ( this . props . alwaysOpen ) ;
150
+ const { alwaysOpen } = this . props ;
151
+
152
+ if ( alwaysOpen ) {
153
+ this . onAnimateOpen ( alwaysOpen ) ;
152
154
}
153
155
154
156
Keyboard . addListener ( 'keyboardDidShow' , this . onKeyboardShow ) ;
@@ -161,17 +163,17 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
161
163
Keyboard . removeListener ( 'keyboardDidHide' , this . onKeyboardHide ) ;
162
164
}
163
165
164
- public open = ( dest : string ) : void => {
165
- const { onOpen, alwaysOpen } = this . props ;
166
+ public open = ( dest : TOpen ) : void => {
167
+ const { onOpen } = this . props ;
166
168
167
169
if ( onOpen ) {
168
170
onOpen ( ) ;
169
171
}
170
172
171
- this . onAnimateOpen ( alwaysOpen , dest ) ;
173
+ this . onAnimateOpen ( undefined , dest ) ;
172
174
} ;
173
175
174
- public close = ( dest : 'alwaysOpen' | 'default' = 'default' ) : void => {
176
+ public close = ( dest : TClose = 'default' ) : void => {
175
177
const { onClose } = this . props ;
176
178
177
179
if ( onClose ) {
@@ -236,7 +238,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
236
238
} ;
237
239
}
238
240
239
- private onAnimateOpen = ( alwaysOpen ? : number , dest ?: string ) : void => {
241
+ private onAnimateOpen = ( alwaysOpen : number | undefined , dest : TOpen = 'default' ) : void => {
240
242
const {
241
243
onOpened,
242
244
snapPoint,
@@ -250,7 +252,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
250
252
251
253
let toValue = 0 ;
252
254
253
- if ( dest === 'fullHeight ' ) {
255
+ if ( dest === 'top ' ) {
254
256
toValue = 0 ;
255
257
} else if ( alwaysOpen ) {
256
258
toValue = ( modalHeight || 0 ) - alwaysOpen ;
@@ -302,7 +304,7 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
302
304
} ) ;
303
305
} ;
304
306
305
- private onAnimateClose = ( dest : 'alwaysOpen' | 'default' = 'default' ) : void => {
307
+ private onAnimateClose = ( dest : TClose = 'default' ) : void => {
306
308
const {
307
309
onClosed,
308
310
useNativeDriver,
@@ -693,7 +695,8 @@ export class Modalize<FlatListItem = any, SectionListItem = any> extends React.C
693
695
closeOnOverlayTap,
694
696
} = this . props ;
695
697
const { showContent } = this . state ;
696
- const pointerEvents = alwaysOpen && this . modalPosition === 'initial' ? 'box-none' : 'auto' ;
698
+ const pointerEvents =
699
+ alwaysOpen && ( this . modalPosition === 'initial' || ! this . modalPosition ) ? 'box-none' : 'auto' ;
697
700
698
701
return (
699
702
< PanGestureHandler
0 commit comments