Change fixture
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
This commit is contained in:
Родитель
88641f850a
Коммит
a174647698
|
@ -930,7 +930,7 @@ const COMMANDS: SchemaType = {
|
|||
},
|
||||
},
|
||||
{
|
||||
name: 'hotspotUpdate',
|
||||
name: 'allTypes',
|
||||
optional: false,
|
||||
typeAnnotation: {
|
||||
type: 'FunctionTypeAnnotation',
|
||||
|
@ -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: {
|
||||
|
|
|
@ -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(
|
||||
|
@ -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);
|
||||
|
@ -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\\")) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
",
|
||||
}
|
||||
|
|
|
@ -152,19 +152,11 @@ export const Commands = {
|
|||
);
|
||||
},
|
||||
|
||||
hotspotUpdate(ref, x, y) {
|
||||
allTypes(ref, x, animated) {
|
||||
UIManager.dispatchViewCommand(
|
||||
findNodeHandle(ref),
|
||||
UIManager.getViewManagerConfig(\\"CommandNativeComponent\\").Commands.hotspotUpdate,
|
||||
[x, y]
|
||||
);
|
||||
},
|
||||
|
||||
scrollTo(ref, y, animated) {
|
||||
UIManager.dispatchViewCommand(
|
||||
findNodeHandle(ref),
|
||||
UIManager.getViewManagerConfig(\\"CommandNativeComponent\\").Commands.scrollTo,
|
||||
[y, animated]
|
||||
UIManager.getViewManagerConfig(\\"CommandNativeComponent\\").Commands.allTypes,
|
||||
[x, animated]
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче