mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-27 22:24:38 +08:00
Fixed wrong placeholder size calculation in multiline text input mode (#23682)
Summary: We have the wrong calculation of placeholder size currently, leads `contentSize` or some things inaccuracy. [iOS] [Fixed] - Fixed wrong placeholder size calculation in multiline text input mode Pull Request resolved: https://github.com/facebook/react-native/pull/23682 Differential Revision: D14255932 Pulled By: cpojer fbshipit-source-id: a1f40e90fc2c848579694965da8316fae9e5c4c5
This commit is contained in:
committed by
Facebook Github Bot
parent
c2071c216e
commit
5b98adf629
@@ -184,7 +184,8 @@ static UIColor *defaultPlaceholderColor()
|
||||
{
|
||||
UIEdgeInsets textContainerInset = self.textContainerInset;
|
||||
NSString *placeholder = self.placeholder ?: @"";
|
||||
CGSize placeholderSize = [placeholder sizeWithAttributes:@{NSFontAttributeName: self.font ?: defaultPlaceholderFont()}];
|
||||
CGSize maxPlaceholderSize = CGSizeMake(UIEdgeInsetsInsetRect(self.bounds, textContainerInset).size.width, CGFLOAT_MAX);
|
||||
CGSize placeholderSize = [placeholder boundingRectWithSize:maxPlaceholderSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: self.font ?: defaultPlaceholderFont()} context:nil].size;
|
||||
placeholderSize = CGSizeMake(RCTCeilPixelValue(placeholderSize.width), RCTCeilPixelValue(placeholderSize.height));
|
||||
placeholderSize.width += textContainerInset.left + textContainerInset.right;
|
||||
placeholderSize.height += textContainerInset.top + textContainerInset.bottom;
|
||||
|
||||
Reference in New Issue
Block a user