Skip to content

Commit def789c

Browse files
reyalpsircfacebook-github-bot
authored andcommitted
Wrong height when TextInput has an empty string
Summary: <!-- Thank you for sending the PR! We appreciate you spending the time to work on these changes. Help us understand your motivation by explaining why you decided to make this change. You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html Happy contributing! --> The caret/cursor did not appear when the TextInput was empty. Found that the cause was because the frame of the TextInput had an height of 0 Just fill and clear a TextInput and the caret/cursor will always appear there. <!-- Help reviewers and the release process by writing your own release notes **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [-{Component}-] [ INTERNAL ] [ ENHANCEMENT ] [ {File} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| [CATEGORY] [TYPE] [LOCATION] - MESSAGE EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> [IOS] [BUGFIX] [TextInput] - This was causing the cursor/caret to not appear since the size of the frame had an height of 0. Closes #18355 Differential Revision: D7319723 Pulled By: shergin fbshipit-source-id: b0249ab5493b6ac310d1898ff20c0bad78cf82c9
1 parent 53a0470 commit def789c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Libraries/Text/TextInput/RCTBaseTextInputShadowView.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ - (NSAttributedString *)measurableAttributedText
180180
// Placeholder also can represent the intrinsic size when it is visible.
181181
NSString *text = self.placeholder;
182182
if (!text.length) {
183-
// Zero-width space
184-
text = @"\u200B";
183+
// Note: `zero-width space` is insufficient in some cases.
184+
text = @"I";
185185
}
186186
attributedText = [[NSAttributedString alloc] initWithString:text attributes:self.textAttributes.effectiveTextAttributes];
187187
}

0 commit comments

Comments
 (0)