From 063fb2e16b16755e9b0f342d10089aa250c0d59d Mon Sep 17 00:00:00 2001 From: Cristiano Santos Date: Tue, 13 Mar 2018 17:02:29 +0000 Subject: [PATCH 1/2] Wrong height when TextInput has an empty string This was causing the cursor/caret to not appear since the size of the frame had an height of 0. --- Libraries/Text/TextInput/RCTBaseTextInputShadowView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m index d1fdbcd3d250..62f2c46751aa 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m @@ -180,8 +180,8 @@ - (NSAttributedString *)measurableAttributedText // Placeholder also can represent the intrinsic size when it is visible. NSString *text = self.placeholder; if (!text.length) { - // Zero-width space - text = @"\u200B"; + // Can't use zero-width space because it sets the height as 0 + text = @"A"; } attributedText = [[NSAttributedString alloc] initWithString:text attributes:self.textAttributes.effectiveTextAttributes]; } From 3beed172c85bd3815daafa4a38f7a194b35c7dee Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sun, 18 Mar 2018 18:20:06 -0700 Subject: [PATCH 2/2] Update RCTBaseTextInputShadowView.m --- Libraries/Text/TextInput/RCTBaseTextInputShadowView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m index 62f2c46751aa..f5a7ca172475 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m @@ -180,8 +180,8 @@ - (NSAttributedString *)measurableAttributedText // Placeholder also can represent the intrinsic size when it is visible. NSString *text = self.placeholder; if (!text.length) { - // Can't use zero-width space because it sets the height as 0 - text = @"A"; + // Note: `zero-width space` is insufficient in some cases. + text = @"I"; } attributedText = [[NSAttributedString alloc] initWithString:text attributes:self.textAttributes.effectiveTextAttributes]; }