Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ios/MobRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,10 @@
height: node.fixedHeight > 0 ? CGFloat(node.fixedHeight) : nil,
alignment: alignment
)
} else if node.fixedHeight > 0 {
stack
.frame(height: CGFloat(node.fixedHeight), alignment: alignment)
.frame(maxWidth: .infinity, alignment: alignment)
} else if node.fillHeight {
// fill_height: true is what lets a wrapping box stretch to the
// viewport so center alignment lands on the visible midpoint
Expand Down Expand Up @@ -1200,7 +1204,7 @@
// no manual frame management required.
private class CameraPreviewUIView: UIView {
override class var layerClass: AnyClass { AVCaptureVideoPreviewLayer.self }
var cameraLayer: AVCaptureVideoPreviewLayer { layer as! AVCaptureVideoPreviewLayer }

Check warning on line 1207 in ios/MobRootView.swift

View workflow job for this annotation

GitHub Actions / Native formatters (clang-format + swiftlint)

Force casts should be avoided (force_cast)
}

private struct MobCameraPreviewView: UIViewRepresentable {
Expand Down Expand Up @@ -2020,4 +2024,4 @@
}
}
}
}

Check warning on line 2027 in ios/MobRootView.swift

View workflow job for this annotation

GitHub Actions / Native formatters (clang-format + swiftlint)

File should contain 2000 lines or less: currently contains 2027 (file_length)
19 changes: 19 additions & 0 deletions test/mob/native_box_layout_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# These source-contract tests guard native SwiftUI behavior that Elixir cannot execute.
# credo:disable-for-this-file Jump.CredoChecks.VacuousTest
defmodule Mob.NativeBoxLayoutTest do
use ExUnit.Case, async: true

@root Path.expand("../..", __DIR__)

test "iOS box applies a fixed height without a fixed width" do
source = File.read!(Path.join(@root, "ios/MobRootView.swift"))

assert source =~
" } else if node.fixedHeight > 0 {\n" <>
" stack\n" <>
" .frame(height: CGFloat(node.fixedHeight), " <>
"alignment: alignment)\n" <>
" .frame(maxWidth: .infinity, alignment: alignment)\n" <>
" } else if node.fillHeight {\n"
end
end
Loading