Fixed wrong contentSize calculation when placeholder is hidden in multiline text input (#23683)

Summary:
Currently, we pick the max size of text view's contentSize and placeholder's size, actually, if placeholder is be hidden, we should only return text view's contentSize.

[iOS] [Fixed] - Fixed wrong contentSize calculation when placeholder is hidden in multiline text input
Pull Request resolved: https://github.com/facebook/react-native/pull/23683

Differential Revision: D14255915

Pulled By: cpojer

fbshipit-source-id: 198faa7e1c5657371eb920973345194aedf72e41
This commit is contained in:
zhongwuzw 2019-02-27 21:52:40 -08:00 коммит произвёл Facebook Github Bot
Родитель fceba0cabe
Коммит c2071c216e
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -195,7 +195,7 @@ static UIColor *defaultPlaceholderColor()
- (CGSize)contentSize
{
CGSize contentSize = super.contentSize;
CGSize placeholderSize = self.placeholderSize;
CGSize placeholderSize = _placeholderView.isHidden ? CGSizeZero : self.placeholderSize;
// When a text input is empty, it actually displays a placehoder.
// So, we have to consider `placeholderSize` as a minimum `contentSize`.
// Returning size DOES contain `textContainerInset` (aka `padding`).