Commit ac7154c
fix(iOS): use prefersPageSizing for modal on iOS 18.0+ (#2797)
## 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 because `UIModalPresentationAutomatic`, which is used by
`react-native-screens` for modal on iOS, has been changed with the
release of iOS 18. `UIModalPresentationAutomatic` is now mapped to
`UIModalPresentationFormSheet` for iOS >=18 and
`UIModalPresentationPageSheet` for 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-screens` v4 using
[`prefersPageSizing`](https://developer.apple.com/documentation/uikit/uisheetpresentationcontroller/preferspagesizing?language=objc)
property of the `UISheetPresentationController` which has been available
since iOS 17.0+.
Resolves
#2549.
## Changes
- use `prefersPageSizing` for modal on iOS 18.0+
## Screenshots / GIFs
### Before

### After

## Test code and steps to reproduce
Open `Modals` example screen and use `Open modal` button.
## Checklist
- [x] Included code example that can be used to test this change
- [x] Ensured that CI passes
---------
Co-authored-by: Kacper Kafara <[email protected]>1 parent da2c028 commit ac7154c
2 files changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
251 | 254 | | |
252 | 255 | | |
253 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
249 | 261 | | |
250 | 262 | | |
251 | 263 | | |
| |||
0 commit comments