Skip to content

[BUG]: Content alignment in Popup does not work #172

Open
@amirsaam

Description

@amirsaam

Prerequisites

  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected Behavior

When aligning popup's content to .leading or .trailing in a VStack they should be aligned correctly in the Popup.

Current Behavior

When calling the popup, the alignment does not work.

Steps to Reproduce

  1. Create some TopPopup with a VStack .leading or .trailing alignment
  2. Call the popup in a View
  3. The Popup content is aligned to center.

Code Sample

My popup struct:

struct TopCustomPopup: TopPopup {

  @Environment(\.colorScheme) var colorScheme

  let isError: Bool
  let message: LocalizedStringKey

  var body: some View {
    VStack(alignment: .leading) {
      HStack {
        ResizableBundledImage(
          imageName: isError ? "cross-circled" : "exclamation-triangle",
          imageSize: 25,
          bundle: .radixUI
        )
        Text(message)
          .font(.custom(.vazir, .caption, .medium))
      }
      .padding(.horizontal, 7.5)
      .padding(.bottom, 7.5)
    }
    .foregroundStyle(colorScheme == .light ? Color.sand12 : Color.sand2)
    .frame(minHeight: 45)
  }

  func configurePopup(config: TopPopupConfig) -> TopPopupConfig {
    config
      .cornerRadius(0)
      .heightMode(.auto)
  }

}

Screenshots

This issue is self explanatory.

Context

SDK 4.0.1
Xcode 16.2
Operating System: iOS 18.2.1
Device: iPhone 12 Pro Max

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions