ReviewOS

also looking at this

craft-native/craft

feat(maps): add key-free native Android maps and shared map controls

#363
Merged chris wants to merge codex/wildloop-native-map-providers into main
28 files +1857 -481

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

packages/ios/fixtures/native-screen/NativeLayoutUnitTests.swiftmodified+8-0
Changes to packages/ios/fixtures/native-screen/NativeLayoutUnitTests.swift
@@ -567,6 +567,8 @@ final class NativeLayoutUnitTests: XCTestCase {
567567 ["id": "expand", "type": "Button", "props": ["testID": "expand", "title": "+"],
568568 "style": ["position": "absolute", "top": 12, "right": 12, "minWidth": 44, "minHeight": 44]],
569569 box("bounded", style: ["position": "absolute", "right": 12, "bottom": 12, "width": 300, "height": 120, "maxWidth": "50%", "maxHeight": 60]),
570 box("wide-ratio", style: ["position": "absolute", "left": 0, "top": 0, "width": 300, "aspectRatio": 2, "maxWidth": 100]),
571 box("tall-ratio", style: ["position": "absolute", "left": 110, "top": 0, "height": 120, "aspectRatio": 2, "maxHeight": 60]),
570572 text("wrapped", "An absolutely positioned label still wraps at its authored maximum width", style: ["position": "absolute", "left": 12, "top": 12, "maxWidth": 80, "fontSize": 17]),
571573 ]))
572574 settle(controller)
@@ -580,6 +582,12 @@ final class NativeLayoutUnitTests: XCTestCase {
580582 XCTAssertEqual(bounded.height, 60, accuracy: 0.5)
581583 XCTAssertEqual(bounded.maxX, root.maxX - 12, accuracy: 0.5)
582584 XCTAssertEqual(bounded.maxY, root.maxY - 12, accuracy: 0.5)
585 let wideRatio = try frame("wide-ratio", in: controller)
586 XCTAssertEqual(wideRatio.width, 100, accuracy: 0.5)
587 XCTAssertEqual(wideRatio.height, 50, accuracy: 0.5, "An automatic height follows the constrained width")
588 let tallRatio = try frame("tall-ratio", in: controller)
589 XCTAssertEqual(tallRatio.width, 120, accuracy: 0.5, "An automatic width follows the constrained height")
590 XCTAssertEqual(tallRatio.height, 60, accuracy: 0.5)
583591 let wrapped = try frame("wrapped", in: controller)
584592 XCTAssertEqual(wrapped.width, 80, accuracy: 0.5)
585593 XCTAssertGreaterThan(wrapped.height, 44, "Width bounds participate in intrinsic text measurement")
packages/ios/templates/CraftNativeScreen.swiftmodified+9-3
Changes to packages/ios/templates/CraftNativeScreen.swift
@@ -2684,15 +2684,21 @@ private class CraftNativeFlowView: UIStackView {
26842684 var fixedHeight = style.top != nil && style.bottom != nil
26852685 ? max(0, content.height - (style.top ?? 0) - (style.bottom ?? 0))
26862686 : style.height?.resolve(content.height)
2687 let authoredWidth = fixedWidth != nil
2688 let authoredHeight = fixedHeight != nil
26872689 (fixedWidth, fixedHeight) = aspectDimensions(style, width: fixedWidth, height: fixedHeight)
26882690 var measured = CraftNativeFlexLayout.measure(child, width: fixedWidth, height: fixedHeight, maxWidth: content.width, maxHeight: content.height)
2689 let boundedWidth = clamp(measured.width, style.minWidth?.resolve(content.width), style.maxWidth?.resolve(content.width))
2690 if abs(boundedWidth - measured.width) > 0.0001 {
2691 var boundedWidth = clamp(measured.width, style.minWidth?.resolve(content.width), style.maxWidth?.resolve(content.width))
2692 let proposedHeight = !authoredHeight && style.aspectRatio != nil ? boundedWidth / style.aspectRatio! : fixedHeight
2693 if abs(boundedWidth - measured.width) > 0.0001 || proposedHeight != fixedHeight {
26912694 // A narrower label or container must wrap before its
26922695 // height and bottom anchor are resolved.
2693 measured = CraftNativeFlexLayout.measure(child, width: boundedWidth, height: fixedHeight, maxWidth: content.width, maxHeight: content.height)
2696 measured = CraftNativeFlexLayout.measure(child, width: boundedWidth, height: proposedHeight, maxWidth: content.width, maxHeight: content.height)
26942697 }
26952698 let boundedHeight = clamp(measured.height, style.minHeight?.resolve(content.height), style.maxHeight?.resolve(content.height))
2699 if !authoredWidth, authoredHeight, let ratio = style.aspectRatio {
2700 boundedWidth = clamp(boundedHeight * ratio, style.minWidth?.resolve(content.width), style.maxWidth?.resolve(content.width))
2701 }
26962702 let x = style.left ?? (style.right.map { content.width - $0 - boundedWidth } ?? 0)
26972703 let y = style.top ?? (style.bottom.map { content.height - $0 - boundedHeight } ?? 0)
26982704 frames.append((child, CGRect(x: content.minX + x, y: content.minY + y, width: boundedWidth, height: boundedHeight)))