Replies: 1 comment
-
Hello, following up on this discussion from Twitter, I was able to implement a proof of concept with only few lines of code. So it's a matter of making it configurable by exposing some public props. Click to see the code diffdiff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm
index 312ea64..6b779f9 100644
--- a/ios/RNSScreen.mm
+++ b/ios/RNSScreen.mm
@@ -156,6 +156,18 @@ - (void)setStackPresentation:(RNSScreenStackPresentation)stackPresentation
// Documented here:
// https://developer.apple.com/documentation/uikit/uiviewcontroller/1621426-presentationcontroller?language=objc
_controller.presentationController.delegate = self;
+
+ if (@available(iOS 15.0, *)) {
+ if (_controller.sheetPresentationController != nil) {
+ _controller.sheetPresentationController.prefersGrabberVisible = true;
+ _controller.sheetPresentationController.largestUndimmedDetentIdentifier =
+ UISheetPresentationControllerDetentIdentifierMedium;
+ _controller.sheetPresentationController.detents = @[
+ UISheetPresentationControllerDetent.mediumDetent,
+ UISheetPresentationControllerDetent.largeDetent
+ ];
+ }
+ }
} else if (_stackPresentation != RNSScreenStackPresentationPush) {
#ifdef RN_FABRIC_ENABLED
// TODO: on Fabric, same controllers can be used as modals and then recycled and used a push which would result in Simulator.Screen.Recording.-.iPhone.13.-.2022-07-18.at.13.41.48.mp4 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thanks for a great library! It'd be wonderful to have access to set
detents
on thesheetPresentationController
property of the view controller that's going to be presented.Showing these medium sized pageSheets and formSheets is becoming more common on iOS. Here's an example of how to use them in Swift: https://sarunw.com/posts/bottom-sheet-in-ios-15-with-uisheetpresentationcontroller/
I'm not sure if there's an equivalent thing on Android.
Beta Was this translation helpful? Give feedback.
All reactions