mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Implement setTextAndSelection as view command in TextInput
Summary: Changelog: Add view command `TextInput.setTextAndSelection` Reviewed By: JoshuaGross Differential Revision: D19789675 fbshipit-source-id: 8eb19bd21b1e153c9639507016a9f452c5f835b0
This commit is contained in:
committed by
Facebook Github Bot
parent
111f04ff11
commit
fb8f5ea07f
@@ -125,6 +125,19 @@ RCT_EXPORT_METHOD(setMostRecentEventCount : (nonnull NSNumber *)viewTag eventCou
|
||||
}];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setTextAndSelection : (nonnull NSNumber *)viewTag
|
||||
mostRecentEventCount : (NSInteger)mostRecentEventCount
|
||||
value : (NSString *)value
|
||||
start : (NSInteger)start
|
||||
end : (NSInteger)end)
|
||||
{
|
||||
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
RCTBaseTextInputView *view = (RCTBaseTextInputView *)viewRegistry[viewTag];
|
||||
view.mostRecentEventCount = mostRecentEventCount;
|
||||
[view setText:value selectionStart:start selectionEnd:end];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - RCTUIManagerObserver
|
||||
|
||||
- (void)uiManagerWillPerformMounting:(__unused RCTUIManager *)uiManager
|
||||
|
||||
Reference in New Issue
Block a user