Please sign in to comment.
Explicitly set default background color in RCTTextView
Summary: RCTShadowText currently explicitly defaults to black text color: https://github.com/facebook/react-native/blob/d46ac11/Libraries/Text/RCTShadowText.m#L204 However, the UITextView used by RCTTextInput doesn't explicitly default to black text color. This causes issues when RCTTextInput is in rich text editing mode (i.e. when the <TextInput> element uses child <Text> nodes to provide extra styling info) and the client doesn't provide us with any explicit color info. In this case, the following series of badness occurs: 1. -[UITextView attributedText] will return an attributed string without the NSColor property set. 2. -[RCTShadowText attributedString] will return an attributed string with NSColor equal to blackColor. 3. The `[_textView.attributedText isEqualToAttributedString:_pendingAttributedText]` check in -performPendingTextUpdate will fail and causes -[UITextView setText:] to be called. 4. -setText: clears the marked text range in the text view, which breaks multi-character autocomplete (e.g. QWERTY input methods for CJK languages). The easiest fix for now is to just make sure RCTUITextView and RCTShadowText default to the same text color. Reviewed By: nicklockwood Differential Revision: D3368726 fbshipit-source-id: a92cb188c60bac80d963af6b1f2a09f27ae084f5
- Loading branch information...