mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Validate selection range passed to setTextAndSelection
Summary: Changelog: [Internal] # Fabric 1. If `start` and `end` parameters in `setTextAndSelection` are -1, we don't move the cursor. Previously the cursor would be moved to beginning of text input. 2. In view commands, do not validate `eventCount`. It is passed in as undefined from JS because Fabric's text input doesn't use `eventCount`. # Paper 1. If `start` and `end` parameters in `setTextAndSelection` are -1, we don't move the cursor. Previously the cursor would be moved to beginning of text input. Reviewed By: shergin Differential Revision: D20538290 fbshipit-source-id: c7aeddc25f58697254474058ce901df958321f7c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fb9a7be2bd
commit
56cf99a96e
@@ -208,8 +208,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
||||
offset:start];
|
||||
UITextPosition *endPosition = [self.backedTextInputView positionFromPosition:self.backedTextInputView.beginningOfDocument
|
||||
offset:end];
|
||||
UITextRange *range = [self.backedTextInputView textRangeFromPosition:startPosition toPosition:endPosition];
|
||||
[self.backedTextInputView setSelectedTextRange:range notifyDelegate:NO];
|
||||
if (startPosition && endPosition) {
|
||||
UITextRange *range = [self.backedTextInputView textRangeFromPosition:startPosition toPosition:endPosition];
|
||||
[self.backedTextInputView setSelectedTextRange:range notifyDelegate:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTextContentType:(NSString *)type
|
||||
|
||||
Reference in New Issue
Block a user