Skip to content

Commit

Permalink
feat(ios): inline sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
lodev09 committed Apr 25, 2024
1 parent ae1111c commit 75f8b2c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions example/src/sheets/InlineSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export const InlineSheet = forwardRef((props: InlineSheetProps, ref: Ref<InlineS
mollit anim id est laborum.
</Text>
<Spacer />
<Button text="Some Button" />
<Button text="Do Not Press Me" />
<Button text="Some Button" onPress={() => sheetRef.current?.resize(1)} />
<Button text="Do Not Press Me" onPress={() => sheetRef.current?.dismiss()} />
</View>
)}
<TrueSheet
Expand Down
8 changes: 4 additions & 4 deletions ios/TrueSheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {

viewController.cornerRadius = cornerRadius
if #available(iOS 15.0, *) {
updatePresentedSheet { sheet in
withPresentedSheet { sheet in
sheet.preferredCornerRadius = viewController.cornerRadius
}
}
Expand All @@ -239,7 +239,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
func setGrabber(_ visible: Bool) {
viewController.grabber = visible
if #available(iOS 15.0, *) {
updatePresentedSheet { sheet in
withPresentedSheet { sheet in
sheet.prefersGrabberVisible = visible
}
}
Expand All @@ -250,7 +250,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
viewController.modal = modal

if #available(iOS 15.0, *) {
updatePresentedSheet { sheet in
withPresentedSheet { sheet in
viewController.configureModalMode(for: sheet)
}
}
Expand All @@ -274,7 +274,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {

/// Use to customize some properties of the Sheet without fully reconfiguring.
@available(iOS 15.0, *)
func updatePresentedSheet(completion: (UISheetPresentationController) -> Void) {
func withPresentedSheet(completion: (UISheetPresentationController) -> Void) {
guard isPresented, let sheet = viewController.sheetPresentationController else {
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export interface TrueSheetProps extends ViewProps {

/**
* Specify whether the sheet is presented modally.
* Set to `false` to allow interaction with the components behind it.
* Set to `false` to allow interaction with the background components.
*
* @default true
*/
Expand Down

0 comments on commit 75f8b2c

Please sign in to comment.