diff --git a/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalSnapPointPreset.swift b/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalSnapPointPreset.swift index d81dac93..0c2b5e11 100644 --- a/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalSnapPointPreset.swift +++ b/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalSnapPointPreset.swift @@ -26,10 +26,10 @@ extension AdaptiveModalSnapPointPreset { forDirection direction: AdaptiveModalConfig.Direction ) -> RNILayoutPreset { switch direction { - case .bottomToTop: return .offscreenTop; - case .topToBottom: return .offscreenBottom; - case .leftToRight: return .offscreenLeft; - case .rightToLeft: return .offscreenRight; + case .bottomToTop: return .edgeTop; + case .topToBottom: return .edgeBottom; + case .leftToRight: return .edgeLeft; + case .rightToLeft: return .edgeRight; }; }; diff --git a/experiments/swift-programmatic-modal/AdaptiveModal/RNILayoutPreset.swift b/experiments/swift-programmatic-modal/AdaptiveModal/RNILayoutPreset.swift index 532bd96e..d8f4f551 100644 --- a/experiments/swift-programmatic-modal/AdaptiveModal/RNILayoutPreset.swift +++ b/experiments/swift-programmatic-modal/AdaptiveModal/RNILayoutPreset.swift @@ -9,6 +9,7 @@ import UIKit enum RNILayoutPreset { case offscreenBottom, offscreenTop, offscreenLeft, offscreenRight; + case halfOffscreenBottom, halfOffscreenTop, halfOffscreenLeft, halfOffscreenRight; case edgeBottom, edgeTop, edgeLeft, edgeRight; case center; @@ -57,6 +58,34 @@ enum RNILayoutPreset { derivedFrom: baseLayoutConfig, verticalAlignment: .bottom ); + + case .halfOffscreenBottom: + return .init( + derivedFrom: baseLayoutConfig, + verticalAlignment: .top, + marginTop: baseRect.height / 2 + ); + + case .halfOffscreenTop: + return .init( + derivedFrom: baseLayoutConfig, + verticalAlignment: .top, + marginTop: -(baseRect.height / 2) + ); + + case .halfOffscreenLeft: + return .init( + derivedFrom: baseLayoutConfig, + horizontalAlignment: .left, + marginLeft: -(baseRect.width / 2) + ); + + case .halfOffscreenRight: + return .init( + derivedFrom: baseLayoutConfig, + horizontalAlignment: .right, + marginRight: baseRect.width / 2 + ); case .edgeTop: return .init(