Skip to content

Commit

Permalink
Remove setMostRecentEventCount from TextInput view commands
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Apr 14, 2020
1 parent 9bc7a07 commit b861782
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 1 addition & 10 deletions Libraries/Components/TextInput/TextInputNativeCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -30,11 +26,6 @@ export interface TextInputNativeCommands<T> {
) => void;
}

const supportedCommands = [
'focus',
'blur',
'setMostRecentEventCount',
'setTextAndSelection',
];
const supportedCommands = ['focus', 'blur', 'setTextAndSelection'];

export default supportedCommands;
8 changes: 0 additions & 8 deletions Libraries/Text/TextInput/RCTBaseTextInputViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@ - (void)setBridge:(RCTBridge *)bridge
}];
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,6 @@ - (void)blur
[_backedTextInputView resignFirstResponder];
}

- (void)setMostRecentEventCount:(NSInteger)eventCount
{
_mostRecentEventCount = eventCount;
}

- (void)setTextAndSelection:(NSInteger)eventCount
value:(NSString *__nullable)value
start:(NSInteger)start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ public void receiveCommand(
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) {
Expand Down

0 comments on commit b861782

Please sign in to comment.