@@ -364,6 +364,8 @@ struct _Text: View, Equatable {
364
364
let textDecoration = textEnvironment. textDecoration
365
365
let textAlign = EnvironmentValues . shared. multilineTextAlignment. asTextAlign ( )
366
366
let maxLines = max ( 1 , EnvironmentValues . shared. lineLimit ?? Int . MAX_VALUE)
367
+ let reservesSpace = EnvironmentValues . shared. lineLimitReservesSpace ?? false
368
+ let minLines = reservesSpace ? maxLines : 1
367
369
let redaction = EnvironmentValues . shared. redactionReasons
368
370
let styleInfo = Text . styleInfo ( textEnvironment: textEnvironment, redaction: redaction, context: context)
369
371
let animatable = styleInfo. style. asAnimatable ( context: context)
@@ -390,7 +392,7 @@ struct _Text: View, Equatable {
390
392
}
391
393
}
392
394
}
393
- options = Material3TextOptions ( annotatedText: annotatedText, modifier: modifier, color: styleInfo. color ?? androidx. compose. ui. graphics. Color. Unspecified, maxLines: maxLines, style: animatable. value, textDecoration: textDecoration, textAlign: textAlign, onTextLayout: { layoutResult. value = $0 } )
395
+ options = Material3TextOptions ( annotatedText: annotatedText, modifier: modifier, color: styleInfo. color ?? androidx. compose. ui. graphics. Color. Unspecified, maxLines: maxLines, minLines : minLines , style: animatable. value, textDecoration: textDecoration, textAlign: textAlign, onTextLayout: { layoutResult. value = $0 } )
394
396
} else {
395
397
var text : String
396
398
if let interpolations {
@@ -403,7 +405,7 @@ struct _Text: View, Equatable {
403
405
} else if styleInfo. isLowercased {
404
406
text = text. lowercased ( )
405
407
}
406
- options = Material3TextOptions ( text: text, modifier: context. modifier, color: styleInfo. color ?? androidx. compose. ui. graphics. Color. Unspecified, maxLines: maxLines, style: animatable. value, textDecoration: textDecoration, textAlign: textAlign)
408
+ options = Material3TextOptions ( text: text, modifier: context. modifier, color: styleInfo. color ?? androidx. compose. ui. graphics. Color. Unspecified, maxLines: maxLines, minLines : minLines , style: animatable. value, textDecoration: textDecoration, textAlign: textAlign)
407
409
}
408
410
if let updateOptions = EnvironmentValues . shared. _material3Text {
409
411
options = updateOptions ( options)
@@ -649,9 +651,13 @@ extension View {
649
651
return self
650
652
}
651
653
652
- @available ( * , unavailable)
653
- public func lineLimit( _ limit: Int , reservesSpace: Bool ) -> some View {
654
+ // SKIP @bridge
655
+ public func lineLimit( _ limit: Int , reservesSpace: Bool ) -> any View {
656
+ #if SKIP
657
+ return environment ( \. lineLimit, limit) . environment ( \. lineLimitReservesSpace, reservesSpace)
658
+ #else
654
659
return self
660
+ #endif
655
661
}
656
662
657
663
@available ( * , unavailable)
0 commit comments