-
-
Notifications
You must be signed in to change notification settings - Fork 609
fix(iOS): use prefersPageSizing for modal on iOS 18.0+ #2797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
kkafar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
kkafar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for remembering that the documentation must also change.
I think we should rephrase the description.
Co-authored-by: Kacper Kafara <[email protected]>
kkafar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
**Motivation** Since the release of iOS 18, screens with`presentation: 'modal'` changed size on devices with a bigger screen, such as an iPad - they became much smaller, which impacted applications of the library's users (see issue software-mansion/react-native-screens#2549). To address the issue, `react-native-screens` will introduce new presentation type for native stack (`pageSheet`) that will allow users to use previous modal behavior (see PR software-mansion/react-native-screens#2793). The behavior of `pageSheet` on Android will be the same as `modal`. Please note that in `react-native-screens`, behavior of regular `modal` has been aligned with previous behavior internally via [`prefersPageSizing` UIKit prop](software-mansion/react-native-screens#2797) in order not to introduce breaking changes. In the future major release of `react-native-screens` however this will be aligned to fully native behavior. This PR contains changes required to support `pageSheet` in `react-navigation`. **Test plan** Open Stack Presentation and Modals example screens in example apps from `react-native-screens` and open a `pageSheet`.
**Motivation** Since the release of iOS 18, screens with`presentation: 'modal'` changed size on devices with a bigger screen, such as an iPad - they became much smaller, which impacted applications of the library's users (see issue software-mansion/react-native-screens#2549). To address the issue, `react-native-screens` will introduce new presentation type for native stack (`pageSheet`) that will allow users to use previous modal behavior (see PR software-mansion/react-native-screens#2793). The behavior of `pageSheet` on Android will be the same as `modal`. Please note that in `react-native-screens`, behavior of regular `modal` has been aligned with previous behavior internally via [`prefersPageSizing` UIKit prop](software-mansion/react-native-screens#2797) in order not to introduce breaking changes. In the future major release of `react-native-screens` however this will be aligned to fully native behavior. This PR contains changes required to support `pageSheet` in `react-navigation`. **Test plan** Open Stack Presentation and Modals example screens in example apps from `react-native-screens` and open a `pageSheet`.
Description
Brings back
stackPresentation: 'modal''s size on iOS 18.0+.Since the release of iOS 18, screens with
stackPresentation: 'modal'changed size on devices with a bigger screen, such as an iPad - they became much smaller, which impacted applications of the library's users (see issue #2549). This happens becauseUIModalPresentationAutomatic, which is used byreact-native-screensfor modal on iOS, has been changed with the release of iOS 18.UIModalPresentationAutomaticis now mapped toUIModalPresentationFormSheetfor iOS >=18 andUIModalPresentationPageSheetfor earlier versions (this was the default before).For more context please see PR #2793 but the TL;DR is that we consider this a breaking change for our users and therefore we decided to bring back the old behavior for
react-native-screensv4 usingprefersPageSizingproperty of theUISheetPresentationControllerwhich has been available since iOS 17.0+.Resolves #2549.
Changes
prefersPageSizingfor modal on iOS 18.0+Screenshots / GIFs
Before
After
Test code and steps to reproduce
Open
Modalsexample screen and useOpen modalbutton.Checklist