File tree Expand file tree Collapse file tree
src/components/Modal/ReanimatedModal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,13 +145,13 @@ function ReanimatedModal({
145145 if ( handleRef . current ) {
146146 InteractionManager . clearInteractionHandle ( handleRef . current ) ;
147147 }
148- // On the web platform, the Modal's onDismiss callback may not be triggered if the dismiss process is interrupted by other actions such as navigation.
149- // Specifically on Android, the Modal's onDismiss callback does not work reliably. There's a reported issue at:
148+ // Because on Android, the Modal's onDismiss callback does not work reliably. There's a reported issue at:
150149 // https://stackoverflow.com/questions/58937956/react-native-modal-ondismiss-not-invoked
151- // Therefore, we manually call onDismiss and onModalHide here.
152- onDismiss ?.( ) ;
153- onModalHide ( ) ;
154- } , [ onDismiss , onModalHide ] ) ;
150+ // Therefore, we manually call onModalHide() here for Android.
151+ if ( getPlatform ( ) === CONST . PLATFORM . ANDROID ) {
152+ onModalHide ( ) ;
153+ }
154+ } , [ onModalHide ] ) ;
155155
156156 const containerView = (
157157 < Container
@@ -208,6 +208,12 @@ function ReanimatedModal({
208208 onRequestClose = { onBackButtonPressHandler }
209209 statusBarTranslucent = { statusBarTranslucent }
210210 testID = { testID }
211+ onDismiss = { ( ) => {
212+ onDismiss ?.( ) ;
213+ if ( getPlatform ( ) !== CONST . PLATFORM . ANDROID ) {
214+ onModalHide ( ) ;
215+ }
216+ } }
211217 // eslint-disable-next-line react/jsx-props-no-spreading
212218 { ...props }
213219 >
You can’t perform that action at this time.
0 commit comments