@@ -1671,6 +1671,12 @@ - (CGRect)firstRectForRange:(UITextRange*)range {
1671
1671
}
1672
1672
}
1673
1673
1674
+ if (@available (iOS 17.0 , *)) {
1675
+ // nothing
1676
+ } else {
1677
+ return CGRectZero ;
1678
+ }
1679
+
1674
1680
NSUInteger first = start;
1675
1681
if (end < start) {
1676
1682
first = end;
@@ -1694,11 +1700,11 @@ - (CGRect)firstRectForRange:(UITextRange*)range {
1694
1700
if (startsOnOrBeforeStartOfRange &&
1695
1701
(endOfTextIsAfterStartOfRange || nextSelectionRectIsAfterStartOfRange)) {
1696
1702
// TODO(hellohaunlin): Remove iOS 17 check. The logic should also work for older versions.
1697
- if (@available (iOS 17 , *)) {
1698
- startSelectionRect = _selectionRects[i].rect ;
1699
- } else {
1700
- return _selectionRects[i].rect ;
1701
- }
1703
+ // if (@available(iOS 17, *)) {
1704
+ startSelectionRect = _selectionRects[i].rect ;
1705
+ // } else {
1706
+ // return _selectionRects[i].rect;
1707
+ // }
1702
1708
}
1703
1709
if (!CGRectIsNull (startSelectionRect)) {
1704
1710
minY = fmin (minY, CGRectGetMinY (_selectionRects[i].rect ));
@@ -1723,6 +1729,7 @@ - (CGRect)firstRectForRange:(UITextRange*)range {
1723
1729
// fmin/fmax to support both LTR and RTL languages.
1724
1730
CGFloat minX = fmin (CGRectGetMinX (startSelectionRect), CGRectGetMinX (endSelectionRect));
1725
1731
CGFloat maxX = fmax (CGRectGetMaxX (startSelectionRect), CGRectGetMaxX (endSelectionRect));
1732
+ NSLog (@" text height is: %f " , maxY - minY);
1726
1733
return CGRectMake (minX, minY, maxX - minX, maxY - minY);
1727
1734
}
1728
1735
}
@@ -2504,16 +2511,16 @@ - (void)setEditableSizeAndTransform:(NSDictionary*)dictionary {
2504
2511
// TODO(hellohuanlin): Also need to handle iOS 16 case, where the auto-correction highlight does
2505
2512
// not match the size of text.
2506
2513
// See https://github.com/flutter/flutter/issues/131695
2507
- if (@available (iOS 17 , *)) {
2508
- // Move auto-correction highlight to overlap with the actual text.
2509
- // This is to fix an issue where the system auto-correction highlight is displayed at
2510
- // the top left corner of the screen on iOS 17+.
2511
- // This problem also happens on iOS 16, but the size of highlight does not match the text.
2512
- // See https://github.com/flutter/flutter/issues/131695
2513
- // TODO(hellohuanlin): Investigate if we can use non-zero size.
2514
- _inputHider.frame =
2515
- CGRectMake ([transform[leftIndex] intValue ], [transform[topIndex] intValue ], 0 , 0 );
2516
- }
2514
+ // if (@available(iOS 17, *)) {
2515
+ // Move auto-correction highlight to overlap with the actual text.
2516
+ // This is to fix an issue where the system auto-correction highlight is displayed at
2517
+ // the top left corner of the screen on iOS 17+.
2518
+ // This problem also happens on iOS 16, but the size of highlight does not match the text.
2519
+ // See https://github.com/flutter/flutter/issues/131695
2520
+ // TODO(hellohuanlin): Investigate if we can use non-zero size.
2521
+ _inputHider.frame =
2522
+ CGRectMake ([transform[leftIndex] intValue ], [transform[topIndex] intValue ], 0 , 0 );
2523
+ // }
2517
2524
}
2518
2525
}
2519
2526
0 commit comments