iPad sizing incorrect on iOS 18+
Before submitting a new issue
- [x] I tested using the latest version of the library, as the bug might be already fixed.
- [x] I tested using a supported version of react native.
- [x] I checked for possible duplicate issues, with possible answers.
Bug summary
Modals are using the incorrect size on iPad. This is most likely related to a similar issue found in react-native-scresns, see: https://github.com/software-mansion/react-native-screens/issues/2549
Library version
2.0.5
Environment info
Steps to reproduce
Create a modal with any sizing on ipad using iOS18
Reproducible example repository
Based on the linked to the issue in react-native-screens, I was able to fix this layout problem on iOS 18 with this patch:
diff --git a/node_modules/@lodev09/react-native-true-sheet/ios/TrueSheetViewController.swift b/node_modules/@lodev09/react-native-true-sheet/ios/TrueSheetViewController.swift
index a116617..4cc7cf0 100644
--- a/node_modules/@lodev09/react-native-true-sheet/ios/TrueSheetViewController.swift
+++ b/node_modules/@lodev09/react-native-true-sheet/ios/TrueSheetViewController.swift
@@ -202,6 +202,10 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
return
}
+ if #available(iOS 18.0, *) {
+ sheet.prefersPageSizing = true
+ }
+
// Configure detents
detentValues = [:]
var detents: [UISheetPresentationController.Detent] = []
I have not done extensive testing on whether this is fully sufficient or not, but it does get sheets back to rending at their fullsize on iOS 18 for iPad while maintaining the expected layout on iPhone.
I'm having the same issue. Adding the:
if #available(iOS 18.0, *) {
sheet.prefersPageSizing = true
}
didn't work
You can now control this in v3 as a prop! Sometimes centered sheet might be good for others :)