Skip to content

Commit

Permalink
support ios15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RyosukeCla committed May 31, 2023
1 parent 916e233 commit ca85a6b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ios/Nativebrik/Classes/page.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ class PageController: UIViewController {
super.init(nibName: nil, bundle: nil)

if page?.data?.kind == PageKind.MODAL {
if let sheet = self.sheetPresentationController {
sheet.detents = parseModalScreenSize(page?.data?.modalScreenSize)
if #available(iOS 15.0, *) {
if let sheet = self.sheetPresentationController {
sheet.detents = parseModalScreenSize(page?.data?.modalScreenSize)
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions ios/Nativebrik/Classes/root.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ class RootViewController: UIViewController {
hasPrevious: true
)
modal.modalPresentationStyle = parseModalPresentationStyle(modalPresentationStyle)
if let sheet = modal.sheetPresentationController {
sheet.detents = parseModalScreenSize(modalScreenSize)
if #available(iOS 15.0, *) {
if let sheet = modal.sheetPresentationController {
sheet.detents = parseModalScreenSize(modalScreenSize)
}
}
self.currentModal = modal
self.presentToTop(modal)
Expand Down
1 change: 1 addition & 0 deletions ios/Nativebrik/Classes/utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func parseModalPresentationStyle(_ data: ModalPresentationStyle?) -> UIModalPres
}
}

@available(iOS 15.0, *)
func parseModalScreenSize(_ data: ModalScreenSize?) -> [UISheetPresentationController.Detent] {
switch data {
case .MEDIUM:
Expand Down

0 comments on commit ca85a6b

Please sign in to comment.