Skip to content

Commit

Permalink
Change fixture
Browse files Browse the repository at this point in the history
Summary: I want a fixture with all the types, so refactoring this so future diffs in the stack are cleaner

Reviewed By: JoshuaGross

Differential Revision: D16509803

fbshipit-source-id: 1f4873701a8ff842f50976377003e1abff187278
  • Loading branch information
elicwhite authored and facebook-github-bot committed Jul 29, 2019
1 parent 88641f8 commit a174647
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ const COMMANDS: SchemaType = {
},
},
{
name: 'hotspotUpdate',
name: 'allTypes',
optional: false,
typeAnnotation: {
type: 'FunctionTypeAnnotation',
Expand All @@ -941,27 +941,6 @@ const COMMANDS: SchemaType = {
type: 'Int32TypeAnnotation',
},
},
{
name: 'y',
typeAnnotation: {
type: 'Int32TypeAnnotation',
},
},
],
},
},
{
name: 'scrollTo',
optional: false,
typeAnnotation: {
type: 'FunctionTypeAnnotation',
params: [
{
name: 'y',
typeAnnotation: {
type: 'Int32TypeAnnotation',
},
},
{
name: 'animated',
typeAnnotation: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol CommandNativeComponentViewProtocol <NSObject>
- (void)flashScrollIndicators;
- (void)hotspotUpdate:(NSInteger)x y:(NSInteger)y;
- (void)scrollTo:(NSInteger)y animated:(BOOL)animated;
- (void)allTypes:(NSInteger)x animated:(BOOL)animated;
@end
RCT_EXTERN inline void CommandNativeComponentHandleCommand(
Expand All @@ -109,7 +108,7 @@ RCT_EXTERN inline void CommandNativeComponentHandleCommand(
return;
}
if ([commandName isEqualToString:@\\"hotspotUpdate\\"]) {
if ([commandName isEqualToString:@\\"allTypes\\"]) {
#if RCT_DEBUG
if ([args count] != 2) {
RCTLogError(@\\"%@ command %@ received %d arguments, expected %d.\\", @\\"CommandNativeComponent\\", commandName, (int)[args count], 2);
Expand All @@ -125,34 +124,6 @@ if ([commandName isEqualToString:@\\"hotspotUpdate\\"]) {
#endif
NSInteger x = [(NSNumber *)arg0 intValue];
#if RCT_DEBUG
NSObject *arg1 = args[1];
if (!RCTValidateTypeOfViewCommandArgument(arg1, [NSNumber class], @\\"number\\", @\\"CommandNativeComponent\\", commandName, @\\"2nd\\")) {
return;
}
#endif
NSInteger y = [(NSNumber *)arg1 intValue];
[componentView hotspotUpdate:x y:y]
return;
}
if ([commandName isEqualToString:@\\"scrollTo\\"]) {
#if RCT_DEBUG
if ([args count] != 2) {
RCTLogError(@\\"%@ command %@ received %d arguments, expected %d.\\", @\\"CommandNativeComponent\\", commandName, (int)[args count], 2);
return;
}
#endif
#if RCT_DEBUG
NSObject *arg0 = args[0];
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @\\"number\\", @\\"CommandNativeComponent\\", commandName, @\\"1st\\")) {
return;
}
#endif
NSInteger y = [(NSNumber *)arg0 intValue];
#if RCT_DEBUG
NSObject *arg1 = args[1];
if (!RCTValidateTypeOfViewCommandArgument(arg1, [NSNumber class], @\\"boolean\\", @\\"CommandNativeComponent\\", commandName, @\\"2nd\\")) {
Expand All @@ -161,7 +132,7 @@ if ([commandName isEqualToString:@\\"scrollTo\\"]) {
#endif
BOOL animated = [(NSNumber *)arg1 boolValue];
[componentView scrollTo:y animated:animated]
[componentView allTypes:x animated:animated]
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,8 @@ public class CommandNativeComponentViewManagerDelegate<T extends View> {
case \\"flashScrollIndicators\\":
viewManager.flashScrollIndicators(view);
break;
case \\"hotspotUpdate\\":
viewManager.hotspotUpdate(view, args.getInt(0), args.getInt(1));
break;
case \\"scrollTo\\":
viewManager.scrollTo(view, args.getInt(0), args.getBoolean(1));
case \\"allTypes\\":
viewManager.allTypes(view, args.getInt(0), args.getBoolean(1));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ import android.view.View;
public interface CommandNativeComponentViewManagerInterface<T extends View> {
// No props
void flashScrollIndicators(T view);
void hotspotUpdate(T view, int x, int y);
void scrollTo(T view, int y, boolean animated);
void allTypes(T view, int x, boolean animated);
}
",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,11 @@ export const Commands = {
);
},
hotspotUpdate(ref, x, y) {
UIManager.dispatchViewCommand(
findNodeHandle(ref),
UIManager.getViewManagerConfig(\\"CommandNativeComponent\\").Commands.hotspotUpdate,
[x, y]
);
},
scrollTo(ref, y, animated) {
allTypes(ref, x, animated) {
UIManager.dispatchViewCommand(
findNodeHandle(ref),
UIManager.getViewManagerConfig(\\"CommandNativeComponent\\").Commands.scrollTo,
[y, animated]
UIManager.getViewManagerConfig(\\"CommandNativeComponent\\").Commands.allTypes,
[x, animated]
);
}
};
Expand Down

0 comments on commit a174647

Please sign in to comment.