react-native-true-sheet icon indicating copy to clipboard operation
react-native-true-sheet copied to clipboard

iPad sizing incorrect on iOS 18+

Open ljukas opened this issue 9 months ago • 1 comments

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

Image

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

ljukas avatar Mar 27 '25 12:03 ljukas

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.

timgcarlson avatar May 05 '25 23:05 timgcarlson

I'm having the same issue. Adding the:

if #available(iOS 18.0, *) {
    sheet.prefersPageSizing = true
}

didn't work

Yusuf-Munir avatar Jun 23 '25 12:06 Yusuf-Munir

You can now control this in v3 as a prop! Sometimes centered sheet might be good for others :)

lodev09 avatar Nov 24 '25 19:11 lodev09