@@ -5,6 +5,7 @@ import {StyleSheet} from 'react-native';
5
5
import { Constants } from '../../helpers' ;
6
6
import { Colors } from '../../style' ;
7
7
import { BaseComponent } from '../../commons' ;
8
+ import { LogService } from '../../services' ;
8
9
import Modal from '../modal' ;
9
10
import View from '../view' ;
10
11
import PanListenerView from '../panningViews/panListenerView' ;
@@ -59,9 +60,13 @@ class Dialog extends BaseComponent {
59
60
*/
60
61
useSafeArea : PropTypes . bool ,
61
62
/**
62
- * Called once the modal has been dissmissed (iOS only)
63
+ * Called once the modal has been dismissed (iOS only) - Deprecated, use onDialogDismissed instead
63
64
*/
64
65
onModalDismissed : PropTypes . func ,
66
+ /**
67
+ * Called once the dialog has been dismissed completely
68
+ */
69
+ onDialogDismissed : PropTypes . func ,
65
70
/**
66
71
* If this is added only the header will be pannable;
67
72
* this allows for scrollable content (the children of the dialog)
@@ -93,6 +98,10 @@ class Dialog extends BaseComponent {
93
98
} ;
94
99
95
100
this . setAlignment ( ) ;
101
+
102
+ if ( ! _ . isUndefined ( props . onModalDismissed ) ) {
103
+ LogService . deprecationWarn ( { component : 'Dialog' , oldProp : 'onModalDismissed' , newProp : 'onDialogDismissed' } ) ;
104
+ }
96
105
}
97
106
98
107
componentDidMount ( ) {
@@ -137,9 +146,20 @@ class Dialog extends BaseComponent {
137
146
onDismiss = ( ) => {
138
147
this . setState ( { modalVisibility : false } , ( ) => {
139
148
const props = this . getThemeProps ( ) ;
140
- _ . invoke ( props , 'onDismiss' , props ) ;
149
+ if ( props . visible ) {
150
+ _ . invoke ( props , 'onDismiss' , props ) ;
151
+ }
152
+ // Parity with iOS Modal's onDismiss
153
+ if ( Constants . isAndroid ) {
154
+ _ . invoke ( props , 'onDialogDismissed' , props ) ;
155
+ }
141
156
} ) ;
142
157
} ;
158
+
159
+ onModalDismissed = ( ) => {
160
+ _ . invoke ( this . props , 'onDialogDismissed' , this . props ) ;
161
+ _ . invoke ( this . props , 'onModalDismissed' , this . props ) ;
162
+ }
143
163
144
164
hideDialogView = ( ) => {
145
165
this . setState ( { dialogVisibility : false } ) ;
@@ -197,7 +217,7 @@ class Dialog extends BaseComponent {
197
217
198
218
render = ( ) => {
199
219
const { orientationKey, modalVisibility} = this . state ;
200
- const { overlayBackgroundColor, onModalDismissed , supportedOrientations, accessibilityLabel} = this . getThemeProps ( ) ;
220
+ const { overlayBackgroundColor, supportedOrientations, accessibilityLabel} = this . getThemeProps ( ) ;
201
221
202
222
return (
203
223
< Modal
@@ -208,7 +228,7 @@ class Dialog extends BaseComponent {
208
228
onBackgroundPress = { this . hideDialogView }
209
229
onRequestClose = { this . hideDialogView }
210
230
overlayBackgroundColor = { overlayBackgroundColor }
211
- onDismiss = { onModalDismissed }
231
+ onDismiss = { this . onModalDismissed }
212
232
supportedOrientations = { supportedOrientations }
213
233
accessibilityLabel = { accessibilityLabel }
214
234
>
0 commit comments