Remove setMostRecentEventCount from TextInput view commands

Summary:
Changelog: [Internal]

We don't use view command `setMostRecentEventCount`, let's get rid of it.

Reviewed By: JoshuaGross

Differential Revision: D21016600

fbshipit-source-id: 6491c063e9d6a89252300cb47c010b248e473f4b
This commit is contained in:
Samuel Susla 2020-04-14 15:25:04 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 9bc7a07de1
Коммит b861782562
8 изменённых файлов: 4 добавлений и 66 удалений

Просмотреть файл

@ -544,12 +544,7 @@ type NativeType = HostComponent<NativeProps>;
type NativeCommands = TextInputNativeCommands<NativeType>;
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: [
'focus',
'blur',
'setMostRecentEventCount',
'setTextAndSelection',
],
supportedCommands: ['focus', 'blur', 'setTextAndSelection'],
});
let AndroidTextInputNativeComponent;

Просмотреть файл

@ -22,12 +22,7 @@ type NativeType = HostComponent<mixed>;
type NativeCommands = TextInputNativeCommands<NativeType>;
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: [
'focus',
'blur',
'setMostRecentEventCount',
'setTextAndSelection',
],
supportedCommands: ['focus', 'blur', 'setTextAndSelection'],
});
const SinglelineTextInputNativeComponent: HostComponent<mixed> = requireNativeComponent<mixed>(

Просмотреть файл

@ -24,12 +24,7 @@ type NativeType = HostComponent<mixed>;
type NativeCommands = TextInputNativeCommands<NativeType>;
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: [
'focus',
'blur',
'setMostRecentEventCount',
'setTextAndSelection',
],
supportedCommands: ['focus', 'blur', 'setTextAndSelection'],
});
let SinglelineTextInputNativeComponent;

Просмотреть файл

@ -17,10 +17,6 @@ import type {Int32} from '../../Types/CodegenTypes';
export interface TextInputNativeCommands<T> {
+focus: (viewRef: React.ElementRef<T>) => void;
+blur: (viewRef: React.ElementRef<T>) => void;
+setMostRecentEventCount: (
viewRef: React.ElementRef<T>,
eventCount: Int32,
) => void;
+setTextAndSelection: (
viewRef: React.ElementRef<T>,
mostRecentEventCount: Int32,
@ -30,11 +26,6 @@ export interface TextInputNativeCommands<T> {
) => void;
}
const supportedCommands = [
'focus',
'blur',
'setMostRecentEventCount',
'setTextAndSelection',
];
const supportedCommands = ['focus', 'blur', 'setTextAndSelection'];
export default supportedCommands;

Просмотреть файл

@ -117,14 +117,6 @@ RCT_EXPORT_METHOD(blur : (nonnull NSNumber *)viewTag)
}];
}
RCT_EXPORT_METHOD(setMostRecentEventCount : (nonnull NSNumber *)viewTag eventCount:(NSInteger)eventCount)
{
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
RCTBaseTextInputView *view = (RCTBaseTextInputView *)viewRegistry[viewTag];
view.mostRecentEventCount = eventCount;
}];
}
RCT_EXPORT_METHOD(setTextAndSelection : (nonnull NSNumber *)viewTag
mostRecentEventCount : (NSInteger)mostRecentEventCount
value : (NSString *)value

Просмотреть файл

@ -404,11 +404,6 @@ using namespace facebook::react;
[_backedTextInputView resignFirstResponder];
}
- (void)setMostRecentEventCount:(NSInteger)eventCount
{
_mostRecentEventCount = eventCount;
}
- (void)setTextAndSelection:(NSInteger)eventCount
value:(NSString *__nullable)value
start:(NSInteger)start

Просмотреть файл

@ -14,7 +14,6 @@ NS_ASSUME_NONNULL_BEGIN
@protocol RCTTextInputViewProtocol <NSObject>
- (void)focus;
- (void)blur;
- (void)setMostRecentEventCount:(NSInteger)eventCount;
- (void)setTextAndSelection:(NSInteger)eventCount
value:(NSString *__nullable)value
start:(NSInteger)start
@ -50,27 +49,6 @@ RCTTextInputHandleCommand(id<RCTTextInputViewProtocol> componentView, NSString c
return;
}
if ([commandName isEqualToString:@"setMostRecentEventCount"]) {
#if RCT_DEBUG
if ([args count] != 1) {
RCTLogError(
@"%@ command %@ received %d arguments, expected %d.", @"TextInput", commandName, (int)[args count], 1);
return;
}
#endif
NSObject *arg0 = args[0];
#if RCT_DEBUG
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"number", @"TextInput", commandName, @"1st")) {
return;
}
#endif
NSInteger eventCount = [(NSNumber *)arg0 intValue];
[componentView setMostRecentEventCount:eventCount];
return;
}
if ([commandName isEqualToString:@"setTextAndSelection"]) {
#if RCT_DEBUG
if ([args count] != 4) {

Просмотреть файл

@ -230,9 +230,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
case "blurTextInput":
reactEditText.clearFocusFromJS();
break;
case "setMostRecentEventCount":
// TODO: delete, this is no longer used from JS
break;
case "setTextAndSelection":
int mostRecentEventCount = args.getInt(0);
if (mostRecentEventCount == UNSET) {