From 084b844dc54eb4e192ba8bff498638e968ea7836 Mon Sep 17 00:00:00 2001 From: Dominic Go <18517029+dominicstop@users.noreply.github.com> Date: Fri, 9 Jun 2023 08:04:06 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20Update:=20Exp=20-=20`AdaptiveMod?= =?UTF-8?q?al`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Update experiment/test - `swift-programmatic-modal/AdaptiveModal`. --- .../RNILayout/RNILayout.swift | 19 +------------------ .../RNILayout/RNILayoutValue.swift | 6 ------ .../Test/RNILayoutTestViewController.swift | 13 ++++++------- 3 files changed, 7 insertions(+), 31 deletions(-) diff --git a/experiments/swift-programmatic-modal/RNILayout/RNILayout.swift b/experiments/swift-programmatic-modal/RNILayout/RNILayout.swift index bfe70825..1b6d8bdd 100644 --- a/experiments/swift-programmatic-modal/RNILayout/RNILayout.swift +++ b/experiments/swift-programmatic-modal/RNILayout/RNILayout.swift @@ -103,12 +103,6 @@ public struct RNILayout { preferredSizeKey: \.height ); - print( - "computeRawRectSize" - + "\n - computedWidth: \(computedWidth)" - + "\n - computedHeight: \(computedHeight)" - ); - return CGSize( width : computedWidth ?? 0, height: computedHeight ?? 0 @@ -213,18 +207,7 @@ public struct RNILayout { let computedMargiVertical = (computedMarginTop ?? 0) + (computedMarginBottom ?? 0); - - print( - "computeRect" - + "\n - computedMarginLeft: \(computedMarginLeft)" - + "\n - computedMarginRight: \(computedMarginRight)" - + "\n - computedMarginTop: \(computedMarginTop)" - + "\n - computedMarginBottom: \(computedMarginBottom)" - + "\n - computedMarginHorizontal: \(computedMarginHorizontal)" - + "\n - computedMargiVertical: \(computedMargiVertical)" - ); - - + // Margin - X-Axis switch self.horizontalAlignment { case .left: diff --git a/experiments/swift-programmatic-modal/RNILayout/RNILayoutValue.swift b/experiments/swift-programmatic-modal/RNILayout/RNILayoutValue.swift index 7ed4db5b..c0e0c426 100644 --- a/experiments/swift-programmatic-modal/RNILayout/RNILayoutValue.swift +++ b/experiments/swift-programmatic-modal/RNILayout/RNILayoutValue.swift @@ -113,12 +113,6 @@ public struct RNILayoutValue { toValue: computedValueRaw ?? 0 ); - print( - "RNILayoutValue.computeValue" - + "\n - computedValueRaw: \(computedValueRaw)" - + "\n - computedValueWithOffsets: \(computedValueWithOffsets)" - ); - return self.clampValue( usingLayoutValueContext: context, forValue: computedValueWithOffsets ?? 0 diff --git a/experiments/swift-programmatic-modal/Test/RNILayoutTestViewController.swift b/experiments/swift-programmatic-modal/Test/RNILayoutTestViewController.swift index 5d5c46a4..af1ec03e 100644 --- a/experiments/swift-programmatic-modal/Test/RNILayoutTestViewController.swift +++ b/experiments/swift-programmatic-modal/Test/RNILayoutTestViewController.swift @@ -31,7 +31,9 @@ class RNILayoutTestViewController : UIViewController { ), height: RNILayoutValue( mode: .constant(100) - ) + ), + marginLeft: .safeAreaInsets(insetKey: \.left), + marginTop: .safeAreaInsets(insetKey: \.top) ), // 1 B RNILayout( @@ -42,7 +44,9 @@ class RNILayoutTestViewController : UIViewController { ), height: RNILayoutValue( mode: .constant(100) - ) + ), + marginRight: .safeAreaInsets(insetKey: \.right), + marginTop: .safeAreaInsets(insetKey: \.top) ), // 2 C RNILayout( @@ -381,11 +385,6 @@ class RNILayoutTestViewController : UIViewController { usingLayoutValueContext: layoutValueContext ); - print( - "updateFloatingView" - + "\n - computedRect: \(computedRect)" - ); - let floatingView = self.floatingView; floatingView.frame = computedRect;