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-07-22 10:58:47 +02:00
committed by grabbou
parent 1f7b0b3333
commit b5fd5d0b4a
8 changed files with 4 additions and 66 deletions
@@ -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
@@ -407,11 +407,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) {