Skip to content

Commit 525a3cf

Browse files
[PM-19506] iOS secure notes truncated (#1516)
1 parent 5ecd456 commit 525a3cf

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

BitwardenShared/UI/Platform/Application/Views/BitwardenUITextView.swift

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,13 @@ struct BitwardenUITextView: UIViewRepresentable {
135135
}
136136
}
137137

138-
recalculateHeight(
139-
view: uiView,
140-
result: $calculatedHeight
141-
)
138+
// Dispatch here to ensure UITextView has a valid width.
139+
DispatchQueue.main.asyncAfter(deadline: UI.after(0.15)) {
140+
recalculateHeight(
141+
view: uiView,
142+
result: $calculatedHeight
143+
)
144+
}
142145
}
143146

144147
/// Recalculates the height of the UIView based on its content size and updates the binding if the height changes.
@@ -164,4 +167,11 @@ struct BitwardenUITextView: UIViewRepresentable {
164167
}
165168
}
166169
}
170+
171+
@available(iOS 16, *)
172+
func sizeThatFits(_ proposal: ProposedViewSize, uiView: UITextView, context: Context) -> CGSize? {
173+
guard let width = proposal.width else { return nil }
174+
let size = uiView.sizeThatFits(CGSize(width: width, height: .greatestFiniteMagnitude))
175+
return CGSize(width: width, height: size.height)
176+
}
167177
}

0 commit comments

Comments
 (0)