react-native-screens
react-native-screens copied to clipboard
iOS: `Screen` with `{ presentation: "modal" }` navigated to from within another react-native's `Modal` doesn't open
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:
- show a
BottomSheet
that is based onreact-native
'sModal
with an action button - 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
- Open https://snack.expo.dev/@bbarthec/react-native-screens-modal-in-modal-issues
- Open the snack in Expo GO (SDK 50 comes with version
3.29.0
) on either physical iPhone or Simulator - Open
BottomSheet
modal & openScreen
modal - seeScreen
is not visible. It's probably mounted using dismissedBottomSheet
modal as an anchor component. - Commend out
setVisible(false)
from line 51 and repeat the process. See the modalScreen
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
yeah, I see why that's happening, thanks for reporting! We will include a fix in incoming release
@kkafar Any news on an incoming fix ? I have a similar issue that I think could be related to this one :)
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?
@kkafar Can you please let us know when a possible fix is planned? Thanks!
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 😅)
Thanks @kkafar I will test it out and come back to you on this.
I've tested it and your fix works! 🎉
Thanks again @kkafar I suppose you can merge this fix.
Great, thanks for checking it out!