react-native-screens icon indicating copy to clipboard operation
react-native-screens copied to clipboard

iOS: `Screen` with `{ presentation: "modal" }` navigated to from within another react-native's `Modal` doesn't open

Open bbarthec opened this issue 6 months ago • 2 comments

Description

https://github.com/software-mansion/react-native-screens/releases/tag/3.29.0 and https://github.com/software-mansion/react-native-screens/pull/1912 are causing breaking change in behaviour of '@react-navigation/native-stack''s Screen that is mounted with { presentation: "modal" }.

Hiding the react-native's Modal that is the most top component in the view hierarchy prevents Screen with { presentation: "modal" } from showing. My scenario:

  1. show a BottomSheet that is based on react-native's Modal with an action button
  2. clicking the button should hide the BottomSheet and navigate to { presentation: "modal" } individual Screen
Before 3.29.0 (3.28.0 here) - desired behaviour 3.29.0 - breaking change 3.29.0 - without BottomSheet autohide

Steps to reproduce

  1. Open https://snack.expo.dev/@bbarthec/react-native-screens-modal-in-modal-issues
  2. Open the snack in Expo GO (SDK 50 comes with version 3.29.0) on either physical iPhone or Simulator
  3. Open BottomSheet modal & open Screen modal - see Screen is not visible. It's probably mounted using dismissed BottomSheet modal as an anchor component.
  4. Commend out setVisible(false) from line 51 and repeat the process. See the modal Screen properly mounts.

Snack or a link to a repository

https://snack.expo.dev/@bbarthec/react-native-screens-modal-in-modal-issues

Screens version

3.29.0

React Native version

0.73

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

None

Device model

No response

Acknowledgements

Yes

bbarthec avatar Feb 22 '24 15:02 bbarthec

yeah, I see why that's happening, thanks for reporting! We will include a fix in incoming release

kkafar avatar Feb 24 '24 09:02 kkafar

@kkafar Any news on an incoming fix ? I have a similar issue that I think could be related to this one :)

kimlesieur avatar Mar 21 '24 14:03 kimlesieur

The issue I described (https://github.com/software-mansion/react-native-screens/issues/2085) is similar to this issue. Any news on the potential fix?

hollanderbart avatar Apr 03 '24 18:04 hollanderbart

@kkafar Can you please let us know when a possible fix is planned? Thanks!

hollanderbart avatar Apr 25 '24 11:04 hollanderbart

Excuse me for late response, @hollanderbart, #2113 should resolve the issue. If you have capacity, I would like to get feedback & confirmation that the patch works also in your case.

You can test out the patch by installing react-native-screens directly from GitHub, by putting following in your package.json:

"react-native-screens": "software-mansion/react-native-screens#@kkafar/fix-presenting-from-react-native-modal"

(watch for typos, as I'm writing from memory 😅)

kkafar avatar Apr 26 '24 11:04 kkafar

Thanks @kkafar I will test it out and come back to you on this.

hollanderbart avatar Apr 26 '24 12:04 hollanderbart

I've tested it and your fix works! 🎉

Thanks again @kkafar I suppose you can merge this fix.

hollanderbart avatar Apr 27 '24 07:04 hollanderbart

Great, thanks for checking it out!

kkafar avatar Apr 27 '24 07:04 kkafar