React-native: [0.63.0][IOS] Modal onDismiss no longer working on IOS

Created on 21 Jul 2020  路  12Comments  路  Source: facebook/react-native

Description

On 0.62.2 onDismiss functions were called on modals being closed. After upgrading to 0.63.0, onDimiss functions are no longer called. This was working fine before upgrading from 62.2 to 63.

React Native version: 0.63.0

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Import { Modal } from react-native
  2. Add modal to render with a function passed into onDismiss property

Expected Results

onDimiss function should be called

Modal iOS PR Submitted

Most helpful comment

Same issue, i upgraded to 0.63 and now when i set the modal visible to false, it don't invoke onDismiss, but when i close the modal of react native navigation, it surprisingly invoke onDismiss, but i don't need when i close the modal of react native navigation. But i need as usual, invoked when i set to false the visible of react native modal.

Steps:

  1. Navigation.showModal https://wix.github.io/react-native-navigation/api/modal/#showmodal
  2. showModal react native
  3. closeModal react native (set to false visible)
  4. No invoke onDismiss
  5. Navigation.dismissAllModals()
  6. Surprisingly run onDismiss of react native modal

All 12 comments

:warning: Missing Environment Information
:information_source: Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console.

Realize that 0.63 is new enough that you can't repro in a Snack, but it would help if you pointed to a Snack that shows this working pre-0.63.

:warning: Missing Reproducible Example
:information_source: It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.

@chrisglein I made an example using Expo SDK 38.0.0, which shows that the behavior is correct in RN 0.62 https://snack.expo.io/@srpoder/excited-cheese

Also the RN Documentation specifies that onDismiss should be available on RN 0.63 https://reactnative.dev/docs/modal#ondismiss

+1 onDismiss not called and not open second modal when i have closed fist modal and open second modal

Same issue, i upgraded to 0.63 and now when i set the modal visible to false, it don't invoke onDismiss, but when i close the modal of react native navigation, it surprisingly invoke onDismiss, but i don't need when i close the modal of react native navigation. But i need as usual, invoked when i set to false the visible of react native modal.

Steps:

  1. Navigation.showModal https://wix.github.io/react-native-navigation/api/modal/#showmodal
  2. showModal react native
  3. closeModal react native (set to false visible)
  4. No invoke onDismiss
  5. Navigation.dismissAllModals()
  6. Surprisingly run onDismiss of react native modal

This fix in RN 0.62.1 doesn't seem to be in RN 0.63.
Is this the cause?
https://github.com/facebook/react-native/commit/27a3248a3b37410b5ee6dda421ae00fa485b525c

We're seeing the same behavior. The onDismiss callback is never called when hiding the modal. I can also confirm the behavior as explained by @diolegend.

In case it helps - I cannot seem to get onDismiss to ever fire on the docs example expo snack using Android either.

Both onDismiss and onHideModal not working for me, tried using the expo snack and also did not work

Workaround is to use onSwipeComplete and onBackdropPress and add callbacks followed by toggle function

still have this issue with react native 0.63.3

Was this page helpful?
0 / 5 - 0 ratings